Functions and CALL Routines |
Verifies the existence of an external file by its physical name.
-
file-name
-
is a character constant, variable, or expression
that specifies a fully qualified physical filename of the external file in
the operating environment.
FILEEXIST returns 1 if the external file
exists and 0 if the external file does not exist. The specification of the
physical name for file-name varies according
to the operating environment.
Although your operating environment utilities might
recognize partial physical filenames, you must always use fully qualified
physical filenames with FILEEXIST.
This example verifies the existence of an external file.
If the file exists, FILEEXIST opens the file. If the file does not exist,
FILEEXIST displays a message in the SAS log. Note that in a macro statement
you do not enclose character strings in quotation marks.
%if %sysfunc(fileexist(&myfilerf)) %then
%let fid=%sysfunc(fopen(&myfilerf));
%else
%put The external file &myfilerf does not exist.;
Copyright © 2011 by SAS Institute Inc., Cary, NC, USA. All rights reserved.