space
Previous Page | Next Page

The BUILD Procedure

MERGE Statement


Copies entries from the catalog specified in the MERGE statement into the current catalog.
Note: The merge operation is performed before the procedure opens any windows.
Tip: By default, all entries in the specified catalog are copied to the current catalog (the catalog that was specified in the PROC BUILD statement). You can use the SELECT= option to select individual entries to copy, or use the EXCLUDE= option to prevent certain entries from being copied.

MERGE CATALOG=<libref.>catalog-name
<ENTRYTYPE=type>
<EXCLUDE=entry-name.entry-type | (entry-list)> | <SELECT=entry-name.entry-type | (entry-list)>
<NOEDIT>
<NOSOURCE>
<REPLACE>
<UPCASE>;

Required Argument

You must always supply the following argument with the MERGE statement:

CATALOG=<libref.>catalog-name
CAT=<libref.>catalog-name
C=<libref.>catalog-name

specifies the SAS catalog from which entries are copied. If you specify a one-level name, it is assumed to be a catalog name in the default WORK library.


Options

You can use the following options in the MERGE statement:

ENTRYTYPE=entry-type
ETYPE=entry-type
ET=entry-type

specifies the type of entry to copy into the merged catalog. By default, entries of all types are copied (unless you also use the SELECT= or EXCLUDE= option). Use the ENTRYTYPE= option to copy only entries of the specified type.

To copy entries of more than one type, use a separate MERGE statement for each entry type.

EXCLUDE=entry-name.entry-type | (entry-list)
SELECT=entry-name.entry-type | (entry-list)

specify entries to exclude from or select for the merge operation. By default, all entries in the specified catalog are copied into the current catalog (unless you also use the ENTRYTYPE= option). Use the EXCLUDE= option to prevent specific entries from being copied. Use the SELECT= option to copy only the specified entries. If you specify more than one entry name for either of these options, enclose the list in parentheses and separate the names with at least one space.

If you use the ENTRYTYPE= option in the same MERGE statement, you can omit the entry-type portion of the entry specification for the EXCLUDE= and SELECT= options because only entries of the type specified in the ENTRYTYPE= option can be copied.

Each MERGE statement can include only one EXCLUDE= option or one SELECT= option. However, you can use multiple MERGE statements with the same PROC BUILD statement.

NOEDIT
NOED

specifies that the entries that are merged into the current catalog cannot be edited with the BUILD procedure. This option is useful when you are moving entries from a development catalog into a production catalog and you want to prevent changes to the entries in the production catalog.

NOSOURCE
NOSRC

specifies that the SCL source programs for PROGRAM entries are not copied.

REPLACE

specifies that entries from the catalog specified in the MERGE statement replace like-named entries in the current catalog. By default, existing entries in the current catalog are not replaced.

UPCASE

converts all text to uppercase during the merge.


Using the MERGE Statement

The MERGE statement merges entries from the specified catalog, sorted in alphabetical order by entry type. Unless you use the ENTRYTYPE=, EXCLUDE=, or SELECT= options, the merge operation attempts to copy all entries from the specified catalog to the current catalog (the catalog that was specified in the PROC BUILD statement). However, if any entries in the current catalog have the same names and types as entries in the specified catalog, then the existing entries in the current catalog are not replaced unless you use the REPLACE option.


MERGE Statement Examples


Example 1: Using the SELECT= and ENTRYTYPE= Options

The following example copies only the entry AAA.HELP from the catalog OLD.CAT1 into the catalog NEW.CAT2:

proc build catalog=new.cat2;
   merge catalog=old.cat1 entrytype=help select=aaa;
run;


Example 2: Using the EXCLUDE= and ENTRYTYPE= Options

The following example copies all the HELP entries except for AAA.HELP and BBB.HELP from the catalog OLD.CAT1 into the catalog NEW.CAT2:

proc build catalog=new.cat2;
   merge catalog=old.cat1 entrytype=help exclude=(aaa bbb);
run;


Example 3: Using the SELECT= Option without the ENTRYTYPE= Option

The following example copies only the entries A.MENU and B.PROGRAM from the catalog OLD.CAT1 into the catalog NEW.CAT2:

proc build catalog=new.cat2;
   merge catalog=old.cat1 select=(a.menu b.program);
run;


Example 4: Using the REPLACE Option

The following example copies all entries of type CBT from the catalog EX.FINAL into the catalog EX.COURSES. If a CBT entry in EX.COURSES has the same name as one that is being copied, the procedure replaces it with the copied entry.

proc build c=ex.courses;
   merge c=ex.final entrytype=cbt replace;
run;

space
Previous Page | Next Page | Top of Page