Previous Page | Next Page

SAS Component Language Dictionary

FILEEXIST



Verifies the existence of an external file, a directory, or a SAS data library by its physical name
Category: External File

Syntax
Details
Example
See Also

Syntax

sysrc=FILEEXIST(filename);

rc

contains the return code for the operation:

1

The external file exists.

0

The external file does not exist.

Type: Numeric

filename

is the name that identifies the external file to the host operating system. The filename specification varies according to the operating system.

Type: Character


Details

FILEEXIST verifies the existence of an external file, a directory, or a SAS data library.

Although your system utilities may recognize partial physical filenames, you must always use fully qualified physical filenames with FILEEXIST.


Example

Verify the existence of an external file whose filename the user enters in the field for the window variable FNAME. Display a message on the message line to tell the user whether the file exists.

if (fileexist(fname)) then
   _msg_='The external file '||fname||' exists.';
else
   _msg_=sysmsg();


See Also

EXIST

FEXIST

FILENAME

FILEREF

PATHNAME

Previous Page | Next Page | Top of Page