Logically combines two or more catalogs into one by associating
them with a catref (a shortcut name); clears one or all catrefs; lists the
concatenated catalogs in one concatenation or in all concatenations
| Valid: |
Anywhere
|
| Category: |
Data Access
|
| See Also: |
LIBNAME statement; FILENAME, CATALOG
statement
|
CATNAME<libref.> catref
<(libref-1.catalog-1 <(ACCESS=READONLY)>
<...libref-n.catalog-n
<(ACCESS=READONLY)>)>
;
CATNAME <libref.> catref CLEAR | _ALL_ CLEAR;
CATNAME
<libref.> catref LIST | _ALL_ LIST;
|
-
libref
-
is any previously-assigned SAS libref. If
you do not specify a libref, SAS concatenates the catalog in the work library,
using the catref that you specify.
-
catref
-
is a unique catalog reference name for a
catalog or a catalog concatenation that is specified in the statement. Separate
the catref from the libref with a period, as in libref.catref. Any SAS name may be used for this
catref.
-
catalog
-
is the name of a catalog to be made available
for use in the catalog concatenation.
-
CLEAR
-
disassociates a currently assigned catref or libref.catref.
-
_ALL_ CLEAR
-
disassociates all currently assigned catref or libref.catref
concatenations.
-
LIST
-
writes the catalog names that are included
in the specified concatenation to the SAS log.
-
_ALL_ LIST
-
writes all catalog names that are included
in any current catalog concatenation to the SAS log.
-
ACCESS=READONLY
-
assigns a read-only attribute to the catalog.
SAS, therefore, will allow users to read from the catalog entries but not
to update information or to write new information.
CATNAME is useful because it allows you to access entries
in multiple catalogs by specifying a single catalog reference name (libref.catref or just catref).
After you create a catalog concatenation, you can specify the catref in any
context that accepts a simple (nonconcatenated) catref.
To
use catalog concatenation effectively, you must understand the rules that
determine how catalog entries are located among the concatenated catalogs:
-
When a catalog entry is opened for input or update,
the concatenated catalogs are searched and the first occurrence of the specified
entry is used.
-
When a catalog entry is opened for output, it
will be created in the first catalog that is listed in the concatenation.
Note:
A new catalog entry is created in the first catalog
even if there is an entry with the same name in another part of the concatenation. ![[cautend]](../common/images/cautend.gif)
-
When you want to delete or rename a catalog entry,
only the first occurrence of the entry is affected.
-
Any time a list of catalog entries is displayed,
only one occurrence of a catalog entry name is shown.
Note:
Even if the name occurs multiple times in the concatenation, only the first
occurrence is shown.
As an example, you may need to access entries in several SAS
catalogs. The most efficient way to access the information is to logically
concatenate the catalogs. This allows access to the information without actually
creating a new, separate, possibly very large catalog.
Assign libnames to the SAS data libraries that contain
the catalogs that you want to concatenate:
libname mylib1 'my-data-library-1';
libname mylib2 'my-data-library-2';
Assign a catref, which can be any valid SAS name, to
the list of catalogs that you want to logically concatenate:
catname allcats (mylib1.catalog1 mylib2.catalog2);
Because no libref is specified, the libref is WORK by
default. When you want to access a catalog entry in either of these catalogs,
use the libref WORK and the catalog reference name ALLCATS instead of the
original librefs and catalog names. For example, to access a catalog entry
named APPKEYS.KEYS in the catalog MYLIB1.CATALOG1, specify
work.allcats.appkeys.keys
Once you have created a concatenated catalog, you can
use CATNAME to combine your concatenation with other single catalogs or other
concatenated catalogs. This is useful, because you can use a single catref
to access many different catalog combinations.
libname local 'my_dir';
libname main 'public_dir';
catname private_catalog (local.my_application_code
local.my_frames
local.my_formats);
catname combined_catalogs (private_catalog
main.public_catalog);
In the above example, an application developer could
be working on private copies of his/her application entries by using PRIVATE_CATALOG.
If the same user wanted to see how his/her entries functioned when they were
combined with the public version of the application, that user could find
out by using COMBINED_CATALOGS.
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.