Chapter Contents

Previous

Next
SAS Companion for UNIX Environments

Librefs Assigned by SAS

The SAS System automatically defines four librefs:

SASHELP
contains a group of catalogs that contain information that is used to control various aspects of your SAS session. The SASHELP library is in the sasroot directory. See The sasroot Directory.

SAUSER
contains SAS catalogs that enable you to tailor features of the SAS System for your needs. If the defaults in the SASHELP library are not suitable for your applications, you can modify them and store your personalized defaults in your SASUSER library.

USER
allows you to read, create, and write files in a SAS data library other than WORK without specifying a libref as part of the SAS file name.

WORK
is the temporary, or scratch, library automatically defined by the SAS System at the beginning of each SAS session or job. The WORK library stores two types of temporary files: those you create and those created internally by the SAS System as part of normal processing.

These librefs and the LIBRARY libref are reserved librefs. If your site also has SAS/GRAPH software or SAS/GIS software, the MAPS or GISMAPS librefs might also be automatically defined. All these libraries are described in SAS Language Reference: Dictionary. SASUSER, USER, and WORK have operating system dependencies.


SASUSER Data Library

When you invoke the SAS System, it looks for one special directory in which to store a data library with the SASUSER libref. If this directory does not exist, the SAS System uses the SASUSER system option to create it. The configuration file usually specifies the directory as follows:

-sasuser ~/sasuser
This specification tells the SAS System to create the SASUSER library in the sasuser subdirectory of your home directory. You can permit read-only access to the SASUSER library by using the RSASUSER system option. See SAS System Options for details on the SASUSER and RSASUSER system options.

Once the SASUSER library has been created, the SAS System automatically assigns the same libref to it each time you start a SAS session. It cannot be cleared or reassigned during a SAS session. If you delete the library, the SAS System re-creates it the next time you start a session.

The SAS System stores your user profile in the SASUSER data library. Your SASUSER.PROFILE catalog contains the tailoring features you specify for the SAS System. By default, this information is taken from the SASHELP library. When you save changes to function key definitions, window attributes, and other information from SAS sessions, the SAS System stores the changes in the SASUSER.PROFILE catalog.

You can, of course, store other data sets and catalogs there as well. Because the SAS System assigns the libref for you, you do not need to use a LIBNAME statement before referencing this library.


WORK Data Library

The WORK data library is the temporary library that is automatically defined by the SAS System at the beginning of each SAS session or job. The WORK data library stores temporary SAS files that you create as well as files created internally by the SAS System.

To access files in the WORK data library, simply specify a one-level name for the file. The libref WORK is automatically assigned to these files unless you have assigned the USER libref.

When you invoke the SAS System, it assigns the WORK libref to a subdirectory of the directory specified in the WORK system option described in SAS System Options. This subdirectory is usually named SAS_workcode where code is a 12-character code based on the process ID of the SAS session. This libref cannot be cleared or reassigned during a SAS session.

The WORKINIT and WORKTERM system options control the creation and deletion of the WORK data library. See SAS Language Reference: Dictionary for details.

Note:   If a SAS session is terminated improperly (for example, using the kill -9 command), the SAS System will not delete the SAS_workcode directory. You may want to use the cleanwork command to delete these straggling directories (see Tools for the System Administrator).  [cautionend]


USER Data Library

SAS data sets are referenced with a one- or two-level name. The two-level name is of the form libref.member-name where libref refers to the SAS data library in which the data set resides and member-name refers to the particular member within that library. The one-level name is of the form member-name (without a libref). In this case, the SAS System stores the files in the temporary WORK data library. To override this action and have files with one-level names stored in a permanent library, 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. You have three ways to assign the USER libref:

See SAS System Options for details on the USER system option.


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.