Previous Page | Next Page

SAS Statements under Windows

LIBNAME Statement: Windows

Associates a libref with a SAS library and lists file attributes for a SAS library.
Valid in: anywhere in a SAS program
Windows specifics: Valid values for engine; specifications for SAS-data-library
See: LIBNAME Statement in SAS Language Reference: Dictionary

Associating Librefs
Listing Data Library Attributes
See Also


LIBNAME libref <engine>'('SAS-data-library-1' <,...'SAS-data-library-n'> ) ' <MEMLIB>, <FILELOCKWAIT>;

Note:   This version is a simplified version of the LIBNAME statement syntax. For the complete syntax and its explanation, see the LIBNAME statement in SAS Language Reference: Dictionary.  [cautionend]


is any valid libref, as documented in SAS Language Reference: Dictionary.


is one of the following library engines supported under Windows:


accesses SAS System 9, SAS 9.1, and SAS 9.2 data sets. You can use the nickname BASE for this engine.


accesses Version 8, Release 8.1, and Release 8.2 data sets.


accesses Version 7 data sets.


accesses Release 6.08 through Release 6.12 data sets.


accesses Release 6.03 and Release 6.04 data sets.

Note:   The V604 engine enables you to read from Release 6.03 and Release 6.04 SAS data sets directly from your 32-bit Windows SAS 9.2 session. Release 6.03 and Release 6.04 SAS data sets are not compatible with the x64 64-bit environment and the Itanium 64-bit environment.  [cautionend]


generates an XML document from a SAS data set.


accesses transport format files.


accesses BMDP data files in a 32-bit operating environment.


accesses OSIRIS data files.


accesses SPSS export files.

For more information about these engines, see Multi Engine Architecture and the discussion of engines in SAS Language Reference: Dictionary.


is the physical name of a SAS library under Windows. It must be a valid Windows pathname or an environment variable that is set to a valid Windows pathname. You can concatenate several Windows directories to serve as a single SAS library. When you specify multiple libraries, use parentheses around the first and last library pathnames. For more information about concatenated SAS libraries, see Understanding How Multi-Folder SAS Libraries Are Accessed.


specifies to use extended server memory for this library. For more information about using extended memory, see Memory-Based Libraries.


specifies the number of seconds SAS will wait for a locked file to become available to another process. If the locked file is released before the number of seconds specified by n, then SAS locks the file for the current process and continues. If the file is still locked when the number of seconds has been reached, then SAS writes a "Locked File" error to the log and the DATA step fails.

Interaction: Specifying the FILELOCKWAIT= option can have an adverse effect on one or more SAS/SHARE server and client sessions that are waiting for the release of a SAS file that is locked by another process. One or more wait conditions could lead to failed processes for a SAS/SHARE server and clients.

To prevent the possibility of a failed SAS/SHARE process, you can set FILELOCKWAIT=0, which cancels the amount of time that a SAS/SHARE server and clients would wait for the release of a locked file. Canceling the wait time would prevent a failed process. For more information, see the FILELOCKWAITMAX= system option, and see the section about predefining a server library by using the LIBNAME statement in the SAS/SHARE User's Guide.

Range: 0 - 600
Default: 0


The LIBNAME statement associates a libref with a permanent SAS library. It can also be used to list the file attributes of a SAS library. (The LIBNAME statement is also used to clear a libref. For more information, see Clearing Librefs.)

Note:   The words AUX, CON, NUL, PRN, LPT1 - LPT9, and COM1 - COM9 are reserved words under Windows. Do not use them as librefs.   [cautionend]

Associating Librefs

Use one of the following forms of the LIBNAME statement to associate a libref or an engine with a SAS library:


LIBNAME libref <engine> 'SAS-data-library'
LIBNAME libref <engine> ('SAS-data-library-1' <,...'SAS-data-library-n')>;

Use quotation marks when SAS-data-library is a physical path. Quotation marks are not needed when you concatenate librefs.

You can use the same arguments with these forms of the LIBNAME statement as shown in the LIBNAME statement syntax.

Listing Data Library Attributes

With the LIST option, you can use the LIBNAME statement to list attributes of SAS libraries. Data Library Attributes Listed by the LIBNAME Statement shows the results of the following LIBNAME statement:

libname sashelp list;

Data Library Attributes Listed by the LIBNAME Statement

5    libname sashelp list;
1    libname sashelp list;
      Scope=    Kernel
      Levels=   27
        -Level 1-
      Engine=   V9
      Physical Name= C:\Program Files\SAS\SASFoundation\9.2\nls\en\SASCFG
      File Name= C:\Program Files\SAS\SASFoundation\9.2\nls\en\SASCFG
        -Level 2-
      Engine=   V9
      Physical Name= C:\Program Files\SAS\SASFoundation\9.2\core\sashelp
      File Name= C:\Program Files\SAS\SASFoundation\9.2\core\sashelp
       . . .

      -Level 27-
      Engine=   V9
      Physical Name= C:\Program Files\SAS\SASFoundation\9.2\webhound\sashelp
      File Name= C:\Program Files\SAS\SASFoundation\9.2\webhound\sashelp
2    run;

See Also

Previous Page | Next Page | Top of Page