Previous Page | Next Page

Functions and CALL Routines

FEXIST Function



Verifies the existence of an external file that is associated with a fileref.
Category: External Files
See: FEXIST Function under Windows UNIX z/OS

Syntax
Argument
Details
Comparison
Examples
See Also

Syntax

FEXIST(fileref)


Argument

fileref

is a character constant, variable, or expression that specifies the fileref that is assigned to an external file.

Restriction: The fileref must have been previously assigned.

Operating Environment Information:   In some operating environments, you can specify a fileref that was assigned with an environment variable. For details, see the SAS documentation for your operating environment.   [cautionend]


Details

FEXIST returns 1 if the external file that is associated with fileref exists, and 0 if the file does not exist. You can assign filerefs by using the FILENAME statement or the FILENAME external file access function. In some operating environments, you can also assign filerefs by using system commands.


Comparison

FILEEXIST verifies the existence of a file based on its physical name.


Examples

This example verifies the existence of an external file and writes the result to the SAS log:

   %if %sysfunc(fexist(&fref)) %then
      %put The file identified by the fileref
         &fref exists.;
   %else
      %put %sysfunc(sysmsg());


See Also

Functions:

EXIST Function

FILEEXIST Function

FILENAME Function

FILEREF Function

Statement:

FILENAME Statement

Previous Page | Next Page | Top of Page