SAS Datasets – how SAS system works with data?

SAS datasets : When starts a SAS session with any mode, there is a work library this is just temporary created directory (default library) where datasets are stored for a SAS session.

SAS datasets can be two types Temporary and permanent dataset.

  • Temporary SAS datasets : It exists only during the session. All the datasets are created in SAS session will be referred as work.Prefix. Once we close the session, we will lost all the datasets from work library.
  • Permanent SAS datasets : To keep the SAS datasets permanently, we need to create our own library in local computer location. Now the datasets will not be deleted even after existing SAS session.

A library in SAS system can be created in two methods, using programming method and GUI method.

Creating permanent SAS Library in Mac.

In our first of creating permanent SAS library in Mac book, we have to create a shared folder in any location on our Mac.

  • Open Documents and create a new folder called “SASUniversityEdition” and created subfolder as “myfolders”.
  • Now share your myfolders folder with Virtualbox.
  • In VirtualBox, select the SAS University Edition vApp, and then select Machine > Settings.
  • In the navigation pane of the Settings window, select Shared Folders, and then click .
  • Before selecting shared folder make sure, create SASUniversityEdition folder and select the myfolders subfolder in Macbook/SASUniversityEdition/myfolders.
  • In the Add Share window, select Other as the folder path.  In the Select Folder window, open the SASUniversityEdition folder and select the myfolders subfolder.
  • Confirm that Read-only is not selected, and then select the Auto-mount and Make Permanent options.
  • Click OK to close the Settings window.
When accessing your data from SAS Studio, you may see an error message similar to the follow ing example:
ERROR: The path /users/xxyyzz/Downloads/Cheatsheet.xlsx is invalid because it is not in the list of accessible paths when SAS is in the lockdown state.
If you see error messages similar to the above examples, you may have shared folders configured incorrectly.
Using the below program, we are creating a library called “Prasanth”. And we specified a location to create prasanth library. So whatever SAS datasets are there in the location will reflect on prasanth library.
Libname prasanth "/folders/myfolders/tutorialkart.com";

Whatever datasets you are creating in front of the dataset use your Libname so that dataset will store into your library and specified location.

Data prasanth.dataset1;
Infile datalines;
input id name$ sex$ age sal;
Datalines;
001 Adarsh M 28 40000
002 Malli M 26 35000
003 Prasanth M 27 30000
;
Run;
  • As shown in above program, prasanth.dataset1 is the name of the table (Dataset).
  • Save the program by selecting the folder as shown below.

SAS program Output Data