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 Statements: Reference

Syntax

LIBNAME libref <engine> '('SAS-data-library-1' <,…'SAS-data-library-n'> ) ' <MEMLIB> ,
<FILELOCKWAIT> ;
LIBNAME libref _ALL_ LIST;
LIBNAME libref _ALL_ CLEAR;

Required Arguments

This version is a simplified version of the LIBNAME statement syntax. For the complete syntax and its explanation, see the LIBNAME statement in LIBNAME Statement in SAS Statements: Reference

libref
is any valid libref, as documented in SAS Statements: Reference.
engine-name
is one of the following library engines supported under Windows:
V9 accesses SAS System 9, SAS 9.1, SAS 9.2 and SAS 9.3 data sets. You can use the nickname BASE for this engine.
V8 accesses Version 8, Release 8.1, and Release 8.2 data sets.
V7 accesses Version 7 data sets.
V6 accesses Release 6.08 through Release 6.12 data sets. 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.
V604 accesses Release 6.03 and Release 6.04 data sets.
XML generates an XML document from a SAS data set.
XPORT accesses transport format files.
BMDP accesses BMDP data files in a 32–bit operating environment.
OSIRIS accesses OSIRIS data files.
SPSS accesses SPSS export files.
For more information about these engines, see Multi Engine Architecture .
SAS-data-library
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.
MEMLIB
specifies to use extended server memory for this library. For more information about using extended memory, see Memory-Based Libraries .
FILELOCKWAIT=n
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.
Default:0
Range:0 – 600
Interactions: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 FILELOCKWAITMAX= System Option: Windows.

Details

Overview of LIBNAME Statement

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.

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. The following LIBNAME statement results in the Data Library Attributes listing:
libname sashelp
list;
Data Library Attributes Listed by the LIBNAME Statement
5    libname sashelp list;
1    libname sashelp list;
NOTE: Libref=   SASHELP
      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

LIBNAME Statement, SASEDOC in SAS Output Delivery System: User's Guide
LIBNAME Statement in SAS Statements: Reference