Chapter Contents |
Previous |
Next |
LIBNAME |
Valid: | Anywhere |
Category: | Data Access |
See Also: | LIBNAME, SAS/ACCESS |
Syntax |
LIBNAME libref
<engine> 'SAS-data-library'
< options > <engine/host-options>; |
LIBNAME libref CLEAR | _ALL_ CLEAR; |
LIBNAME libref LIST | _ALL_ LIST; |
LIBNAME libref <engine> (library-specification-1
<. . . library-specification-n>)
< options > ; |
Tip: | The association between a libref and a SAS data library lasts only for the duration of the SAS session or until you change it or discontinue it with another LIBNAME statement. |
Operating Environment Information: For details on specifying the physical names of files, see the SAS documentation for your operating environment.
In some operating environments, you can use an operating environment command, the LIBNAME statement, or the LIBNAME function to associate the libref with the SAS data library. In others, you must use an operating environment command. See the SAS documentation for your operating environment for more information.
Restriction: | When concatenating libraries, you cannot specify options that are specific to an engine or an operating environment. |
Featured in: | Logically Concatenating SAS Data Libraries |
See Also: | Rules for Library Concatenation |
Tip: | Generally, SAS automatically determines the appropriate engine to use for accessing the files in the library. If you want to create a new library with an engine other than the default engine, you can override the automatic selection. |
See: | For a list of valid engines, see the SAS documentation for your operating environment. For background information about engines, see SAS Language Reference: Concepts. |
Tip: | Specify libref to disassociate a single libref. Specify _ALL_ to disassociate all currently assigned librefs. |
Tip: | Specify libref to list the attributes of a single SAS data library. Specify _ALL_ to list the attributes of all SAS data libraries that have librefs in your current session. |
Options |
READONLY | assigns a read-only attribute to an entire SAS data library. SAS will not allow you to open a data set in the library in order to update information or write new information. | ||
TEMP | indicates that the SAS data library
be treated as a scratch library. That is, the system will not consume CPU
cycles to ensure that the files in a TEMP library do not become corrupted.
|
Operating Environment Information: Some operating environments support LIBNAME statement options that have similar functions to the ACCESS= option. See the SAS documentation for your operating environment.
MVS
CMS VSE VAX_VMS ALPHA_VMS ALPHA_OSF SOLARIS HP_UX RS_6000_AIX WINDOWS OS2 MAC |
YES | specifies that a new empty data set with a given
name replaces an existing data set with the same name. This is the default.
| ||||
NO | specifies that a new empty data set with a given
name does not replace an existing data set with the same name.
|
Comparison: | For an individual data set, the REPEMPTY= data set option overrides the setting of the REPEMPTY= option in the LIBNAME statement. |
See Also: | REPEMPTY= |
Interaction: | A translation table that is specified with the TRANTAB= data set option for a specific data set overrides the translation table that is specified with the TRANTAB= option in the LIBNAME statement for an entire library. |
Operating Environment Information: For a list of valid specifications, see the SAS documentation for your operating environment.
Engine-Host-Options |
Operating Environment Information: For a list of valid specifications, see the SAS documentation for your operating environment.
Restriction: | When concatenating libraries, you cannot specify options that are specific to an engine or an operating environment. |
Details |
The association between a libref and a SAS data library lasts only for the duration of the SAS session or until you change it or discontinue it with another LIBNAME statement. The simplest form of the LIBNAME statement specifies only a libref and the physical name of a SAS data library:
Syntax |
LIBNAME libref 'SAS-data-library'; |
See Assigning and Using a Libref.
An engine specification is usually not necessary. If the situation is ambiguous, SAS uses the setting of the ENGINE= system option to determine the default engine. If all data sets in the library are associated with a single engine, SAS uses that engine as the default. In either situation, you can override the default by specifying another engine with the ENGINE= option:
Syntax |
LIBNAME libref engine
'SAS-data-library'
<options > <engine/host-options>; |
Operating Environment Information: Using
the LIBNAME statement requires host-specific information. See the SAS documentation
for your operating environment before using this statement.
To disassociate a libref from a SAS data library, use a LIBNAME statement, specifying the libref and the CLEAR option. You can clear a single, specified libref or all current librefs.
Syntax |
LIBNAME libref CLEAR | _ALL_ CLEAR; |
Syntax |
LIBNAME libref LIST | _ALL_ LIST; |
Syntax |
|
In the same LIBNAME statement you can use any combination
of specifications: librefs, physical pathnames, or a combination of librefs
and pathnames. See Logically Concatenating SAS Data Libraries.
When you logically concatenate two or more SAS data libraries, you also implicitly concatenate the SAS catalogs that have the same name. For example, if three SAS data libraries each contain a catalog named CATALOG1, then when you concatenate them, you implicitly create a catalog concatenation for the catalogs that have the same name. See Implicitly Concatenating SAS Catalogs.
Syntax |
|
After you create a library concatenation, you can specify the libref in any context that accepts a simple (nonconcatenated) libref. These rules determine how SAS files (that is, members of SAS libraries) are located among the concatenated libraries:
Note: A new SAS file is created in the first library even if there is a file with
the same name in another part of the concatenation.
Note: Even if
the name occurs multiple times in the concatenation, only the first occurrence
is shown.
Comparisons |
Examples |
libname sales 'SAS-data-library'; data sales.quarter1; infile 'your-input-file; input salesrep $20. +6 jansales febsales marsales; run; proc print data=sales.quarter1; run;
libname allmine ('path-1' 'path-2' 'path-3');
libname v6 'path-to-v6-library'; libname v7 'path-to-v7-library'; libname allmine (v6 v7);
libname allmine (v6 v7 'some-path');
This example concatenates three SAS data libraries by specifying the physical filename of each and assigns the libref ALLMINE to the concatenated libraries:
libname allmine ('path-1' 'path-2' 'path-3');
If each library contains a SAS catalog named MYCAT,
then using ALLMINE.MYCAT as a libref.catref provides access to the catalog
entries that are stored in all three catalogs named MYCAT. To logically concatenate
SAS catalogs with different names, see CATNAME.
If you want the convenience of specifying only a one-level name for permanent, not temporary, SAS files, use the USER= system option. This example stores data set QUARTER1 permanently without using a LIBNAME statement first to assign a libref to a storage location:
options user='SAS-data-library'; data quarter1; infile 'your-input-file; input salesrep $20. +6 jansales febsales marsales; run; proc print data=quarter1; run;
See Also |
Statements:
| |||||||
System
Option:
|
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.