SAS Day 7: Libname
The other day, the data team asked me if I can convert an Excel file to SAS dataset and store it in the data folder. I end up not knowing how to save the converted SAS dataset. Thanks very much to June, now I know Iibname is not only for reading data, but it can also be used to store datasets!
Libname consist of:
- the keyword LIBNAME.
- the name that you want to use.
- the pathname that represents the physical location of the library.
- a semicolon.
- Assign the name to the location we can fetch the data from.
- Assign the name to the location we can store our data in.
Syntax:
libname adam ‘C:\Users\fangy\Desktop\All\3study’ access = readonly;

Pexels / Pixabay
- Fetch Data
We can use set statement to read in any dataset we want.
Example: we want ADSL.
data adsl;
set adam.adsl;
run;
2. Store Data
We can use set statement to store any dataset in the location assigned to libname.
Example: we want to store final into adam library.
data adam.qcadsl;
set final;
run;
Happy SAS Coding 🦀