Chapter Contents

Previous

Next
LIBNAME

LIBNAME



Associates or disassociates one or more SAS data libraries with a libref; lists the characteristics of a SAS data library

Valid: anywhere
UNIX specifics: engine, library, and engine/host-options


Syntax
Details
Engine/Host Options
See Also

Syntax

LIBNAME libref <engine> 'SAS-data-library' <options> <engine/host-options>;
LIBNAME libref <engine> ('library-1'<,...library-n>) <options>;
LIBNAME libref ('library-1'|libref-1,...,'library-n'|librefn);
LIBNAME libref CLEAR|_ALL _ CLEAR;
LIBNAME libref LIST|_ALL _ LIST;

libref
is any valid libref as documented in SAS Language Reference: Dictionary. The SAS System reserves some librefs for special system libraries. See Librefs Assigned by SAS for more information.

engine
is one of the library engines supported under UNIX. See Details for a description of the engines. If no engine name is specified, the SAS System determines which engine to useas described in Omitting Engine Names From the LIBNAME Statement.

'SAS-data-library'
differs according to the engine that you specify and according to your current working directory. Engine Names and Descriptions describes what each engine expects for this argument. Specify directory pathnames as described in Specifying Pathnames. You cannot create directories with the LIBNAME statement. The directory that you specify here must already exist, and you must have permissions to it. Enclose the data library name in quotes. Remember that UNIX pathnames are case-sensitive.

'library-n'|libref-n
are pathnames or librefs (that have already been assigned) for the data libraries that you want to access with one libref. Use these forms of the LIBNAME statement when you want to concatenate data libraries. Separate the pathnames with either commas or blank spaces. Enclose library pathnames in quotation marks. Do not enclose librefs in quotation marks. See Assigning a Libref to Several Directories (Concatenating Directories) for more information .

options
are LIBNAME statement options that are available in all operating environments. See SAS Language Reference: Dictionary for information about these options.

engine/host-options
can be any of the options described in Engine/Host Options.

_ALL_
refers to all librefs currently defined. You can use this keyword when you are listing or clearing librefs.

CLEAR
clears the specified libref or, if you specify _ALL_, clears all librefs that are currently defined. SASUSER, SASHELP, and WORK remain assigned.

Note:   When you clear a libref defined by an environment variable, the variable remains defined, but it is no longer considered a libref. You can still reuse it, either as a libref or a fileref. See Using Environment Variables as Librefs for more information.   [cautionend]

The SAS System automatically clears the association between librefs and their respective data libraries at the end of your job or session. If you want to associate an existing libref with a different SAS data library during the current session, you do not have to end the session or clear the libref. The SAS System automatically reassigns the libref when you issue a LIBNAME statement for the new SAS data library.

LIST
prints to the SAS log the engine, pathname, file format, access permissions, and so on, that are associated with the specified libref or, if you specify _ALL_, prints this information for all librefs that are currently defined. Librefs defined as environment variables appear only if you have already used those librefs in a SAS statement.


Details

There are two main types of engines:

View engines
enable the SAS System to read SAS data views that are described by SAS/ACCESS software, the SQL procedure, and DATA step views. The use of SAS view engines is automatic because the name of the view engine is stored as part of the descriptor portion of the SAS data set.

Library engines
control access at the SAS data library level. Every SAS data library has an associated library engine, and the files in that library can be accessed only through that engine. There are two types of library engines:

native engines
access SAS files created and maintained by the SAS System. See Engine Names and Descriptions for a description of these engines.

interface engines
treat other vendors' files as if they were SAS files. See Engine Names and Descriptions and Accessing BMDP, OSIRIS, or SPSS Data Files for more information.

Engine Names and Descriptions
Engine Type Name (Alias) Description SAS-data-library
default V8 (BASE)V7 enables you to create new SAS data files and access existing SAS data files that were created with Version 7 or Version 8. The V7 and V8 engines are identical. This engine enables read access to data files that were created with some earlier versions of SAS, but this engine is the only one that supports Version 8 catalogs. This engine allows for data set indexing and compression and is also documented in SAS Language Reference: Dictionary. is the pathname of the directory containing the library.
sequential V8TAPE

(TAPE)

V7TAPE

V6TAPE

accesses SAS data files that were created in a sequential format, whether on tape or on disk. This engine requires less overhead than the default engine because sequential access is simpler than random access. This engine is also documented in SAS Language Reference: Dictionary. is the name of the special file (see Introduction to External Files and Devices) associated with the sequential device, such as /dev/rmt/0mn.
compatibility V6 accesses any data file that was created by Release 6.07 through 6.12. is the pathname of the directory containing the library.
servers SPDS enables communication between a client session and a data server. You must have the Scalable Performance Data Server licensed on your client machine to use this engine. Refer to Scalable Performance Data Server User's Guide, Version 2 for more information. is the logical LIBNAME domain name for an SPDS data library on the server machine. The name server resolves the domain name into the physical path for the library.

MDDB enables communication between a client session and an MDDB server. You must have SAS/MDDB Server licensed either or your client machine or on your server machine to use this engine. Refer to SAS MDDB Server Software: Administration Guide for complete information.
transport XPORT accesses transport data sets. This engine creates machine-independent SAS transport files that can be used under all hosts running Release 6.06 or later of the SAS System. This engine is documented in Moving and Accessing SAS Files across Operating Environments. is the pathname of either a sequential device or a disk file.
interface BMDP provides read-only access to BMDP files. This engine is available only on AIX, HP-UX, and Solaris. is the pathname of the data file.

OSIRIS provides read-only access to OSIRIS files. is the pathname of the data file.

SPSS provides read-only access to SPSS files is the pathname of the data file.


Engine/Host Options

The LIBNAME statement accepts the FILELOCKS option:

FILELOCKS=NONE|FAIL|CONTINUE
This option specifies whether file locking is on or off for the library that you are defining. This LIBNAME statement option works like the FILELOCKS system option, except that it applies only to the library that you are defining. See FILELOCKS for more information.

You can also specify any of the options supported by the SPDS engines. SPDS is the Scalable Performance Data Server. Refer to Scalable Performance Data Server User's Guide, Version 2 for a description of these options.

See Also


Chapter Contents

Previous

Next

Top of Page

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