May I ask how to assign a permanent lib to data? Thanks.
Welcome to the SAS Communities 🙂
What version of SAS do you use?
If you are on 9.x, then click the 'New Library' Button at the top ribbon to get the below window. Then choose the 'Enable at startup' box and fill in the rest accordingly.
Hi,
The following is an example of the LIBNAME statement and SET statement that is used with a DATA step:
libname pdata 'your-data-library'; data ds1; set pdata;
by ID;
run; proc print data = ds1; run;
Here, PDATA,DS1 and ID are used generically.
Hope this helps.
Regards,
Nasya
Hi,
In order to create and save a permanent SAS data file in a library you'll want to use the following syntax:
libname pdata 'your-data-library'; /*Path for where you want to store data set/where your data is located*/
data pdata.ds1; /* New permanent SAS data file stored in pdata library. */
set ds1; /* temporary SAS data file*/
run;
You define the library reference with a libname statement. In order for a library to be "permanent" (available for use everytime a new SAS session starts), you need to have it somewhere in the structures that could be called "part of the autoexec process". Depending on your SAS setup, this could be
(this list is not complete by far)
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.