Functions and CALL Routines |
Verifies the existence of a SAS catalog or SAS catalog entry.
-
entry
-
is a character constant, variable,
or expression that specifies a SAS catalog, or the name of an entry in a catalog.
If the entry value is a one- or two-level name,
then it is assumed to be the name of a catalog. Use a three- or four-level
name to test for the existence of an entry within a catalog.
-
'U'
-
tests whether the catalog can be opened
for updating.
CEXIST returns 1 if the SAS catalog or
catalog entry exists, or 0 if the SAS catalog or catalog entry does not exist.
This example verifies the existence of the entry X.PROGRAM
in LIB.CAT1:
data _null_;
if cexist("lib.cat1.x.program") then
put "Entry X.PROGRAM exists";
run;
This example tests whether the catalog LIB.CAT1 exists
and can be opened for update. If the catalog does not exist, a message is
written to the SAS log. Note that in a macro statement you do not enclose
character strings in quotation marks.
%if %sysfunc(cexist(lib.cat1,u)) %then
%put The catalog LIB.CAT1 exists and can be opened for update.;
%else
%put %sysfunc(sysmsg());
Copyright © 2011 by SAS Institute Inc., Cary, NC, USA. All rights reserved.