Chapter Contents

Previous

Next
LIBNAME

LIBNAME



Associates a libref with a SAS data library and lists file attributes for a SAS data library

Language element: statement
Valid: anywhere in a SAS program
OpenVMS specifics: valid values for engine-name; specifications for SAS-data-library; valid values for engine/host-option-list


Syntax
Details
Associating Librefs
Listing Data Library Attributes
See Also

Syntax

LIBNAME libref <engine> 'SAS-data-library'
<portable-options> <engine/host-options>;
LIBNAME libref | _ALL_CLEAR;
LIBNAME libref | _ALL_ LIST;

Note:   This 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]

For an explanation of the LIBNAME statement arguments in the OpenVMS operating environment, see Associating Librefs.


Details

The LIBNAME statement associates a libref with a permanent SAS data library and lists the file attributes of a SAS data library.

Note:   The LIBNAME statement is also used to clear a libref. For complete documentation on this use, see the LIBNAME statement in SAS Language Reference: Dictionary.  [cautionend]

Associating Librefs

Use the following form of the LIBNAME statement to associate a libref, an engine, or engine/host options with a SAS data library:

LIBNAME libref <engine> 'SAS-data-library' 
   <portable-options> <engine/host-options>;
libref
is a SAS name that complies with SAS naming conventions and is used in SAS statements to point to SAS-data-library. This argument is required.

The libref can also be an OpenVMS logical name or a search-string logical name. For more information, see Using an OpenVMS Logical Name in the LIBNAME Statement and Using a Search-String Logical Name to Concatenate SAS Data Libraries.

Under OpenVMS, the only reserved librefs are those that are reserved by the SAS System on all operating environments. For a list of reserved librefs, see the LIBNAME statement in SAS Language Reference: Dictionary.

engine
tells SAS which engine to use for accessing the library. For a list of valid engine names for OpenVMS, see Engines Available under OpenVMS. The engine that is associated with a libref accesses only files that were created by that engine, not other SAS files.

If you do not specify an engine, then SAS uses the procedures described in How SAS Assigns an Engine When No Engine Is Specified to assign an engine for you.

SAS-data-library
is the name of the directory that contains the SAS data library, enclosed in quotes. You can omit this argument if you are merely specifying the engine for a libref or an OpenVMS logical name that you previously assigned.

If the directory that you specify does not already exist, then you must create it before you attempt to use the libref that you have assigned to it. (Under OpenVMS, the LIBNAME statement does not actually create directories.)

Use the following syntax for concatenated libraries:

LIBNAME libref  ('SAS-data-library' '...'
Note that librefs can be used as part of a physical name or a previously assigned libref.

The level of specification depends on your current location in the OpenVMS file structure. For example, if you want to access a directory that is located on another node in your OpenVMS network, then the file specification in the LIBNAME statement must include the node, the device, and the directory levels.

The file specification generally must not extend beyond the directory or subdirectory level (that is, it must not include a filename), because the libref/directory association that is made in the LIBNAME statement gives you access to all SAS files in the data library, not to a single file. However, this rule does not apply if you are assigning a libref for use with the XPORT, OSIRIS, or SPSS engines.

SAS-data-library can also be an OpenVMS logical name (or a path that contains a logical name). In this case, you would be assigning a libref to the logical name, and you would subsequently use the libref in your SAS program. For examples, see Using an OpenVMS Logical Name in the LIBNAME Statement.

Note:   Directory wildcard specifications are not supported in LIBNAME statements. If you use an asterisk (*) or an ellipsis (...) in the SAS-data-library argument, an error message tells you that the physical name of the library is invalid.  [cautionend]

portable-options
are LIBNAME statement options that are available in all operating environments. For information about these options, see the LIBNAME statement in SAS Language Reference: Dictionary.

engine/host-options
are one or more of the following host-specific options:

ALQ=
specifies how many disk blocks to allocate to a new SAS data set. For more information, see the data set option ALQ=.

ALQMULT=
specifies the number of pages that are preallocated to a file. For more information, see the data set option ALQMULT=.

BKS=
specifies the bucket size for a new data set. For more information, see the data set option BKS=.

CACHENUM=
specifies the number of I/O data caches used per SAS file. For more information, see the data set option CACHENUM=.

CACHESIZ=
controls the size of the I/O data cache that is allocated for a file. For more information, see the data set option CACHESIZ=.

DEQ=
tells OpenVMS how many disk blocks to add when it automatically extends a SAS data set during a 'write' operation. For more information, see the data set option DEQ=.

DEQMULT=
specifies the number of pages to extend a SAS file. For more information, see the data set option DEQMULT=.

MBF=
specifies the multibuffer count for a data set. For more information, see the data set option MBF=.

For a complete listing of the available external I/O statement options, see Summary of External I/O Statement Options in the FILENAME statement.

Not every option is available with every engine. For information about which engine or host options are available with each engine, see Using SAS Engines.

All of these options correspond to a data set option of the same name and have the same effect as the data set option. However, engine or host options apply to all SAS data sets that are stored in the SAS data library.

Specify as many options as you need. Separate them with a blank space.


Listing Data Library Attributes

You can use the LIBNAME statement to list attributes of SAS data libraries by using the LIST option.

See Also


Chapter Contents

Previous

Next

Top of Page

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