Previous Page | Next Page

SAS Component Language Dictionary

SEARCH



Creates or manipulates the current catalog search path
Category: Catalog

Syntax
Details
Example
See Also

Syntax

rc=SEARCH(cat-name|special-argument);

rc

contains the return code for the operation:

0

successful

-1

not successful

Type: Numeric

cat-name

is the catalog to push to the front of the current search list.

Type: Character

special-argument

are any of the following:

'-DISABLE'

to disable the current search list.

'-ENABLE'

to enable the current search list. If there is no disabled list, then the current search list remains empty.

'-POP'

to remove the first name from the current search list.

'-POPALL'

to clear the current search list.

Note:   You must include the hyphen (-) as the first character in each of these argument values. Otherwise, the value will be treated as a catalog name in the WORK library.  [cautionend]

Type: Character


Details

You do not need to know the exact location of a catalog member, only that it is in one of the catalogs in the current search path.

When a function that uses the current search path is called, the catalogs in the search path are searched from first to last until the specified entry is found or until the end of the search path is reached.

If there is no current search path, or if the current search path has been disabled or overridden, then the search is limited to the current catalog.


Example

Set up a search list with MYLIB1.CAT1, MYLIB1.CAT2 and MYLIB1.CAT3. Each time SEARCH is called, the new value of the argument is pushed to the front of the list. Therefore, MYLIB1.CAT3 is searched first. If MYPROG.PROGRAM exists only in MYLIB1.CAT1, it still executes correctly, because MYLIB1.CAT1 is also in the search path.

rc=search('mylib1.cat1');
rc=search('mylib1.cat2');
rc=search('mylib1.cat3');
call display('myprog.program');


See Also

CEXIST

DISPLAY

SEARCHPATH

Previous Page | Next Page | Top of Page