BASE SAS Programming – SAS Libraries

Many concepts seem intertwined when we study SAS. It is important to be patient and keep pushing through. Fundamental concepts are the key to understanding more advanced concepts. Welcome back fellow readers. We hope you have been able to follow along up to this point without much trouble.

In this post we will be looking into SAS Libraries. There are two types of libraries in SAS. There are permanent and temporary libraries. Temporary libraries are store data set only for the current session. Permanent libraries store data sets to a permanent location on the local system. Consider the screenshot below:

All the default libraries in SAS University Edition are listed in the left pane under the libraries section. Notice the ‘Work’ library. This is the default library created for any temporary data sets created in the current session. As seen in the SAS program written in the right pane, the temporary data set ‘sample’ is created in the ‘work’ library. These data sets won’t exist after the session is closed.

To understand how SAS creates the permanent libraries in SAS, let us consider the screenshots below:

In the above screenshot we can see the Libname statement being used to create a permanent library. Simultaneously consider the the screenshot below where the log indicates the successful creation of the permanent library ‘Test1’. Also notice, the changes in the left pane of SAS University interface. There is a permanent library ‘Test1’ with a data set ‘sample’ saved. As you can see the log indicates a successful run of the program, so the expected changes are now updated.

We hope this post provides some clarity on SAS libraries. You can now try to now start trying to create your own permanent libraries. Please note, if you are using any other  software to run SAS programs, similar interface elements should be present where you may locate the relevant local paths to libraries and based on how the project folders are created. For instance, the layout for BASE SAS tool would be somewhat similar but the path for the libraries would be more kin to an actual system path instead of the one shown in the sample SAS program.

Keep practicing and leave comments in case you face any challenges. Please find relevant reference books in the sidebar, if you should want to purchase the same for further studying. Please sign up for our newsletter, so that we may keep you posted on the latest activity on our website and Youtube channel.