![]() Chapter Contents |
![]() Previous |
![]() Next |
Definitions |
Example 1: Implicit Concatenation |
This LIBNAME statement concatenates the two SAS data libraries:
libname both ('SAS-Data-library 1''SAS-Data-library 2' );
If library1 contains these members ... | and library2 contains these members ... | |
---|---|---|
MYCAT.CATALOG | MYCAT.CATALOG | |
TABLE 1.DATA | MYCAT2.CATALOG | |
TABLE3.DATA | TABLE1.DATA | |
TABLE1.INDEX | ||
TABLE2.DATA | ||
TABLE2.INDEX |
Concatenated libref BOTH |
---|
MYCAT.CATALOG (from path 1 and 2) |
MYCAT2.CATALOG (from path 2) |
TABLE1.DATA (from path 1) |
TABLE2.DATA (from path2) |
TABLE2.INDEX (from path2) |
TABLE3.DATA (from path1) |
So what happened to the catalogs when the libraries were concatenated? A resulting catalog now exists logically in memory, with the full name BOTH.MYCAT.CATALOG. This catalog combines each of the two physical catalogs residing in 'library 1' and 'library2', called MYCAT.CATALOG.
To understand the contents of the concatenation BOTH.MYCAT, first look at the contents of both parts of the concatenation. Assume that the two original MYCAT.CATALOG files contain the following:
MYCAT.CATALOG in library1 contains ... | MYCAT.CATALOG in library 2 contains ... | |
---|---|---|
A.FRAME | A.GRSEG | |
C.FRAME | B.FRAME | |
C.FRAME |
BOTH.MYCAT |
---|
A.GRSEG (from path 2) |
A.FRAME (from path 1) |
B.FRAME (from path 2) |
C.FRAME (from path 1) |
Example 2: Explicit Concatenation |
The syntax of the CATNAME statement is:
CATNAME libref.catref (libref-1.catalog-1 (ACCESS=READONLY) libref-n.catalog-n (ACCESS=READONLY));
To disassociate a concatenated catalog the syntax is:
CATNAME libref.catref | _ALL_ clear;In the following example, there must be a libref that is defined and named CATDOG. The libref catdog establishes the scope for the explicit concatenation definition.
Note: If a file in catdog named COMBINED.CATALOG already
exists, it becomes unaccessible until the explicit concatenation CATDOG.COMBINED
is cleared.
If library1 contains these members ... | and library2 contains these members ... | |
---|---|---|
MYCAT.CATALOG | MYDOG.CATALOG | |
TABLE1.DATA | MYCAT2.CATALOG | |
TABLE3.DATA | TABLE1.DATA | |
TABLE1.INDEX | ||
TABLE2.DATA | ||
TABLE2.INDEX |
CATNAME catdog.combined (library1.mycat (ACCESS=READONLY) library2.mydog (ACCESS=READONLY));then the concatenated catalog CATDOG.COMBINED would combine the following catalogs:
Concatenated catalog CATALOG.COMBINED |
---|
MYCAT.CATALOG (from library 1) |
MYDOG.CATALOG (from library 2) |
Note: In explicit
concatenation only the named catalogs
are combined. In implicit concatenation, any catalogs that happen to have
the same name in their respective libraries are concatenated when those libraries
are concatenated.
The previous CATNAME statement creates a catalog
that exists logically in memory, named CATDOG.COMBINED.CATALOG, which combines
the two physical catalogs residing in library1 and library2, called MYCAT.CATALOG
and MYDOG.CATALOG.
To understand the contents of the concatenation COMBINED.CATALOG, first look at the contents of both parts of the concatenation. The two original catalog files contain the following entries:
MYCAT.CATALOG library 1 |
MYDOG.CATALOG library 2 |
|
---|---|---|
A.FRAME | A.GRSEG | |
C.FRAME | B.FRAME | |
C.FRAME |
COMBINED.CATALOG contents |
---|
A.GRSEG (from MYDOG) |
A.FRAME (from MYCAT) |
B.FRAME (from MYDOG) |
C.FRAME (from MYCAT) |
Rules for Catalog Concatenation |
Note: A new catalog entry is created
in the first catalog even if there is an item with the same name in another
part of the concatenation.
Note: If the first catalog in
a concatenation that is opened for update does not exist, the item will be
written to the next catalog that exists in the concatenation.
Note: Even if a catalog entry occurs multiple times in the concatenation,
only the first occurrence is shown.
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.