Libraries [3-3]


Creating a Permanent Library

You can create your own library by using a LIBNAME statement.


Libname Newlib '/home/your_user_name';

The LIBNAME statement consists of three parts:

    This tells SAS to create a new library.
  2. Newlib:
    This is the name of the library.
  3. '/home/your_user_name':
    ​This is the directory path to the library.

Note: you must change the path to include your unique home directory location. For more details, please visit here.

The LIBNAME statement above creates a library called Newlib:

The Newlib library is directly connected to the home directory on your SAS server.

Saving a Data Set

You can save a current SAS data set by simply copying the data into the permanent library using a SET statement.


** Please change the path in the Libname statement below **;

Libname Newlib '/home/your_user_name';

Data Newlib.Cars;
Set SASHelp.Cars;

In this example, the data is read from the SASHelp library and written into the Newlib library.

The CARS data set is created in the Newlib library:

✍️ Exam Tips

In order to create a permanent library, you need to submit the LIBNAME statement.

The Work library is the only temporary library in SAS. All other libraries are permanent.

The SET statement is used to copy the data from one data set to another.

When referencing a permanent library, the library reference must be used.

? Sample Exam Question(s):
Question 2
Question 3
Question 4
Question 5
Question 6

Get Solution