subsequent SAS sessions. Normally, you specify that data sets be stored in or retrieved
from this library by specifying a one-level name. Files held in the Work library are
deleted at the end of the SAS session if it ends normally.
There are a number of SAS system options that enable you to customize how you name
and work with your permanent and temporary SAS libraries. See the USER=, WORK=,
WORKINIT, and WORKTERM system options in SAS System Options: Reference for
Definition of a Metadata-Bound Library
A metadata-bound library is a physical library that is tied to a corresponding metadata
secured table object. Each physical table within a metadata-bound library has
information in its header that points to a specific metadata object. The pointer creates a
security binding between the physical table and the metadata object. The binding ensures
that SAS universally enforces metadata-layer access requirements for the physical table
—regardless of how a user requests access from SAS. For more information, see SAS
Guide to Metadata-Bound Libraries.
The AUTHLIB procedure is used to create, access, and modify metadata-bound
libraries. This procedure is intended for use by SAS administrators. Users who lack
sufficient privileges in either the metadata layer or the host layer cannot use this
procedure. For more information, see “AUTHLIB Procedure” in Base SAS Procedures
SAS System Libraries
Introduction to SAS System Libraries
Four special libraries supplied by SAS provide convenience, support, and customization
Definition of Work Library
The Work library is the temporary (scratch) library that is automatically defined by SAS
at the beginning of each SAS session. The Work library stores two types of temporary
files: those that you create and those that are created internally by SAS as part of normal
processing. Typically, the Work library is deleted at the end of each SAS session if the
session terminates normally.
SAS System Libraries 593
Using the Work Library
To store or retrieve SAS files in the Work library, specify a one-level name in your SAS
program statements. The libref Work is automatically assigned to these files as a system
default unless you have assigned the User libref. The following examples contain valid
names for SAS data sets stored in the Work library:
proc contents data=testdata;
proc contents data=work.testdata;
Operating Environment Information
The Work library is implemented differently in various operating environments. See
the SAS documentation for your operating environment for more information.
Relation to the User Library
While the Work library is designed to hold temporary files used during the current SAS
session, the User library is designed to hold files after the SAS session is over. If you
associate the libref User with a SAS library, use a one-level name to create and access
files that are not deleted at the end of your SAS session. When SAS encounters a one-
level filename, it looks first in the User library, if it has been defined, and then it looks in
Work. If you want to place a file in the User library, so that it is not deleted after your
SAS session is over, any single-level file goes there by default. At that point, if you want
to create a temporary file in Work, you must use a two-level name, such as Work.Name.
Definition of User Library
The User library enables you to read, create, and write to files in a SAS library other
than Work without specifying a libref as part of the SAS filename. Once you associate
the libref User with a SAS library, SAS stores any file with a one-level name in that
library. Unlike the Work library, files stored in this library are not deleted by SAS when
the session terminates.
Ways to Assign the User Libref
You can assign the User libref using one of the following methods:
• LIBNAME statement
• LIBNAME function
• USER= system option
• operating environment command
In this example, the LIBNAME statement is used with a DATA step, which stores the
data set Region in a permanent SAS library.
libname user 'SAS-library';
... more DATA step statements ...
In this example, the LIBNAME function assigns the User libref:
x=libname ('user', 'SAS-library');
594 Chapter 26 • SAS Libraries