Chapter Contents

Previous

Next

Catalog Concatenation


Definitions

You can logically combine two or more SAS catalogs by concatenating them. This allows you to access the contents of several catalogs, using one catalog name. There are two types of concatenation, explicit and implicit.

Implicit catalog concatenation
results from a concatenation of libraries through a LIBNAME statement. When two or more libraries are logically combined through concatenation, any catalogs with the same name in each library become logically combined as well.

Explicit catalog concatenation
is a concatenation that is specified by the global CATNAME statement in which the catalogs to be concatenated are specifically (or explicitly) named. During explicit catalog concatenation, the CATNAME statement sets up a logical catalog in memory.


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

The concatenated libref BOTH would have the following:

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)

Notice that TABLE1.INDEX does not show up in the concatenation but TABLE2.INDEX does. SAS suppresses listing the index when its associated data file is not part of the concatenation.

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

The combined catalog BOTH.MYCAT contains:

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.  [cautionend]

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

and if we issue the following statement,

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.  [cautionend]
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

The concatenated catalog COMBINED contains:

COMBINED.CATALOG contents
A.GRSEG (from MYDOG)
A.FRAME (from MYCAT)
B.FRAME (from MYDOG)
C.FRAME (from MYCAT)


Rules for Catalog Concatenation

The rules for catalog concatenation are the same, whether the the catalogs are implicitly or explicitly concatenated.


Chapter Contents

Previous

Next

Top of Page

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