Previous Page | Next Page

Functions and CALL Routines

FILEEXIST Function



Verifies the existence of an external file by its physical name.
Category: External Files
See: FILEEXIST Function under Windows UNIX OpenVMS z/OS

Syntax
Argument
Details
Examples
See Also

Syntax

FILEEXIST(file-name)


Argument

file-name

is a character constant, variable, or expression that specifies a fully qualified physical filename of the external file in the operating environment.


Details

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.


Examples

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.;


See Also

Functions:

EXIST Function

FEXIST Function

FILENAME Function

FILEREF Function

FOPEN Function

Previous Page | Next Page | Top of Page