To load and work with sas database files in the sas7bdat format we need to first install - foreign, sas7bdat package in R.
Please use the below commands to install the packages and load them in R.

Command: install.packages("foreign") 
Command: install.packages("sas7bdat") 
Command: library(foreign)
Command: library(sas7bdat)

sas7bdat.sources is a data collection of internet resources for SAS database files in the sas7bdat format. Lets load that source in R
Command: data("sas7bdat.sources")
Command: head(sas7bdat.sources)

It will list you the sas files with the URL from where you can access them.
Lets consider drugprob.sas7bdat and see how to read that file in R.

To read the data of drugprob.sas7bdat you need to give the URL. The url corresponding to the respective file name will help you in retrieving the data. You can find the filename and its respective URL by running the head(sas7bdat.sources)

Please use the below commands to load this file in R.


Please refer to the below screenshot of the output it displays.

Hope this helps.