Using One-Level Names to Access Permanent Files (User Library)

Introduction to One-Level Names

SAS data sets are referenced with a one- or two-level name. The two-level name has the form libref.member-name, where libref refers to the SAS library in which the data set resides, and member-name refers to the particular member within that library. The one-level name has the form member-name (without a libref). In this case, SAS stores the files in the temporary Work library. To override this action and have files with one-level names stored in a permanent library, you must first assign the User libref to an existing directory. To refer to temporary SAS files while User is assigned, use a two-level name with WORK as the libref.

Techniques for Assigning the User Libref

You have three ways to assign the User libref:
  • Assign the User libref directly using the LIBNAME statement:
    libname user '/users/myid/mydir';
  • Specify the USER= system option before you start the SAS session. For example, you can assign the User libref when you invoke SAS:
    sas -user /users/myid/mydir
  • Specify the USER= system option after you start the SAS session. First, assign a libref to the permanent library. Then, use the USER= system option in an OPTIONS statement to equate that libref to User. For example, these statements assign the libref User to the directory with libref mine:
    libname mine '/users/myid/mydir'; 
    options user=mine;
For information about the USER system option, see USER System Option: UNIX.
Note: SAS on UNIX does not support the assignment of the User libref using the USER environment variable.