Chapter Contents

Previous

Next
The CATALOG Procedure

Concepts


Interactive Processing with RUN Groups

Definition

The CATALOG procedure is interactive. Once you submit a PROC CATALOG statement, you can continue to submit and execute statements or groups of statements without repeating the PROC CATALOG statement.

A set of procedure statements ending with a RUN statement is called a RUN group. The changes specified in a given group of statements take effect when a RUN statement is encountered.

How to End a PROC CATALOG Step

In the DATA step and most SAS procedures, a RUN statement is a step boundary and ends the step. A simple RUN statement does not, however, end an interactive procedure. To terminate a PROC CATALOG step, you can

Note:   When you enter a QUIT, DATA, or PROC statement, any statements following the last RUN group execute before the CATALOG procedure terminates. If you enter a RUN statement with the CANCEL option, however, the remaining statements do not execute before the procedure ends.  [cautionend]

See Displaying Contents, Changing Names, and Changing a Description .

Error Handling and RUN Groups

Error handling is based in part on the division of statements into RUN groups. If a syntax error is encountered, none of the statements in the current RUN group execute, and execution proceeds to the next RUN group.

For example, the following statements contain a misspelled DELETE statement:

   proc catalog catalog=misc entrytype=help;
      copy out=drink;
         select coffee tea;
      del juices;        /* INCORRECT!!! */
      exchange glass=plastic;
   run;
      change calstats=nutri;
   run;

Because the DELETE statement is incorrectly specified as DEL, no statements in that RUN group execute, except the PROC CATALOG statement itself. The CHANGE statement does execute, however, because it is in a different RUN group.

CAUTION:
Be careful when setting up batch jobs in which one RUN group's statements depend on the effects of a previous RUN group, especially when deleting and renaming entries.   [cautionend]


Specifying an Entry Type

Four Ways to Supply an Entry Type

There is no default entry type, so if you do not supply one, PROC CATALOG generates an error. You can supply an entry type in one of four ways. See Supplying an Entry Type .

Supplying an Entry Type
You can supply an entry type with... Example
the entry name
delete
test1.program
       test1.log test2.log;
ET= in parenthesis
delete
test1 (et=program);
ET= after a slash (table note 1)
delete test1 (et=program)
       test1 test2 / et=log;
ENTRYTYPE= without a slash (table note 2)
proc catalog catalog=mycat et=log;
     delete test1 test2;

TABLE NOTE 1:  in a subordinate statement [arrow]

TABLE NOTE 2:  in the PROC CATALOG or the COPY statement [arrow]

All statements, except the CONTENTS statement, accept the ENTRYTYPE= (alias ET=) option.

Why Use the ENTRYTYPE= Option?

ENTRYTYPE= can save keystrokes when you are processing multiple entries of the same type.

To create a default for entry type for all statements in the current step, use ENTRYTYPE= in the PROC CATALOG statement. To set the default for only the current statement, use ENTRYTYPE= in a subordinate statement.

If many entries are of one type, but a few are of other types, you can use ENTRYTYPE= to specify a default and then override that for individual entries with (ENTRYTYPE=) in parenthesis after those entries.

Avoid a Common Error

You cannot specify the ENTRYTYPE= option in both the PROC CATALOG statement and a subordinate statement. For example, these statements generate an error and do not delete any entries because the ENTRYTYPE= specifications contradict each other:
/* THIS IS INCORRECT CODE. */
proc catalog cat=sample et=help;
   delete a b c / et=program;
run;

The ENTRYTYPE= Option

The ENTRYTYPE= option is available in every statement in the CATALOG procedure except CONTENTS.
ENTRYTYPE=etype
not in parenthesis, sets a default entry type for the entire PROC step when used in the PROC CATALOG statement. In all other statements, this option sets a default entry type for the current statement.
Alias: ET=
Default: If you omit ENTRYTYPE=, PROC CATALOG processes all entries in the catalog.
Interaction: If you specify ENTRYTYPE= in the PROC CATALOG statement, do not specify either ENTRYTYPE= or (ENTRYTYPE=) in a subordinate statement.
Interaction: (ENTRYTYPE=etype) in parenthesis immediately following an entry name overrides
ENTRYTYPE= in that same statement.
Tip: On all statements except the PROC CATALOG and COPY statements, this option follows a slash.
Tip: To process multiple entry types in a single PROC CATALOG step, use ENTRYTYPE= in a subordinate statement, not in the PROC CATALOG statement.
See also: Specifying an Entry Type .
Featured in: Copying, Deleting, and Moving Catalog Entries from Multiple Catalogs

(ENTRYTYPE=etype)
in parenthesis, identifies the type of the entry just preceding it.
Alias: (ET=)
Restriction: (ENTRYTYPE=etype) immediately following an entry name in a subordinate statement cannot override an ENTRYTYPE= option in the PROC CATALOG statement. It generates a syntax error.
Interaction: (ENTRYTYPE=etype) immediately following an entry name overrides ENTRYTYPE= in that same statement.
Tip: This form is useful mainly for specifying exceptions to an ENTRYTYPE= option used in a subordinate statement. The following statement deletes A.HELP, B.FORMAT, and C.HELP:

   delete a b (et=format) c / et=help;
Tip: For the CHANGE and EXCHANGE statements, specify (ENTRYTYPE=) in parenthesis only once for each pair of names following the second name in the pair. For example,

   change old1=new1 (et=log) 
          old1=new2 (et=help);
See also: Specifying an Entry Type
Featured in: Copying, Deleting, and Moving Catalog Entries from Multiple Catalogs and Displaying Contents, Changing Names, and Changing a Description


Catalog Concatenation
Catalog concatenation was not available prior to Version 7 of the SAS System . The CATALOG procedure supports both implicit and explicit concatenation of catalogs. All statements and options that can be used on single (unconcatenated) catalogs can be used on catalog concatenations.

Restrictions

When you use the CATALOG procedure to copy concatenated catalogs and you use the NEW option, the following rules apply:
  1. If the input catalog is a concatenation and if the output catalog exists in any level of the input concatentation, the copy is not allowed.

  2. If the output catalog is a concatenation and if the input catalog exists in the first level of the output concatenation, the copy is not allowed.

For example, the following code demonstrates these two rules, and the copy fails:

libname first 'path-name1';
libname second 'path-name2';
/* create contat.x */
libname concat (first second);

/* fails rule #1 */
proc catalog c=concat.x;
   copy out=first.x new;
run;
quit;

/* fails rule #2 */
proc catalog c=first.x;
   copy out=concat.x new;
run;
quit;

In summary, the following table shows when copies are allowed. In the table, A and B are libraries, and each contains catalog X. Catalog C is an implicit concatenation of A and B, and catalog D is an implicit concatenation of B and A.

Input catalog Output catalog Copy allowed?
C.X B.X No
C.X D.X No
D.X C.X No
A.X A.X No
A.X B.X Yes
B.X A.X Yes
C.X A.X No
B.X C.X Yes
A.X C.X No


Chapter Contents

Previous

Next

Top of Page

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