SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Setting Up Your SAS Session
Referencing Files in SAS Libraries


Assigning Librefs

To define libraries, you can use a LIBNAME statement. You can store the LIBNAME statement with any SAS program to reference the SAS library automatically when you submit the program.


General form, basic LIBNAME statement:
LIBNAME libref 'SAS-data-library';

where

  • libref is 1 to 8 characters long; begins with a letter or underscore; and contains only letters, numbers, or underscores.

  • SAS-data-library is the name of the SAS library where the file is stored. The specification of the physical name of the library differs by operating environment and machine.


The LIBNAME statement below assigns the libref Clinic to the SAS library D:\Users\Qtr\Reports in the Windows environment.
     libname clinic 'd:\users\qtr\reports';

How Long Librefs Remain in Effect

The LIBNAME statement is global, which means that its settings remain in effect until you modify them, cancel them, or end your SAS session.

Therefore, the LIBNAME statement assigns the libref for the current SAS session only. You must assign a libref each time that you begin a SAS session in order to access SAS files stored in a permanent SAS library. (Remember that Work is the default libref for a temporary SAS library.)


librefs assigned and deassigned

Remember that when you use the New Library Window to create a libref, you can select Enable at Startup and your libref will be created each time you start SAS.

back||next


Copyright © 2002 SAS Institute Inc., Cary, NC, USA. All rights reserved.

Terms of Use & Legal Information | Privacy Statement