FILEEXIST Function: Windows

Verifies the existence of an external file by its physical name.

Category: External Files
Restriction: If the SAS session in which you are specifying the FILEEXIST function is in a locked-down state, and the pathname specified in the function has not been added to the lockdown path list, then the function fails and a file access error related to the locked-down data is not generated in the SAS log unless you specify the SYSMSG function.
See: FILEEXIST Function in SAS Functions and CALL Routines: Reference
FILENAME Function in SAS Functions and CALL Routines: Reference

Syntax

FILEEXIST("filename")

Required Argument

filename

specifies a fully qualified physical filename of the external file. In a DATA step, filename can be a character expression, a string in quotation marks, or a DATA step variable. In a macro, filename can be any expression.

Under Windows, filename can be a complete path, and an environment variable. The filename or environment variable that you specify must be enclosed in quotation marks.
Note The FILEEXIST function can also verify a directory’s existence.

Details

FILEEXIST returns 1 if the external file exists and 0 if the external file does not exist.