FILEREF Function


Verifies that a fileref has been assigned for the current SAS session

Category: External Files

See: FILEREF Function in the documentation for your operating environment.

Syntax

FILEREF ( fileref )

Argument

fileref

  • specifies the fileref to be validated .

  • Range: 1 to 8 characters

Details

A negative return code indicates that the fileref exists but the physical file associated with the fileref does not exist. A positive value indicates that the fileref is not assigned. A value of zero indicates that the fileref and external file both exist.

A fileref can be assigned to an external file by using the FILENAME statement or the FILENAME function.

Operating Environment Information: Under some operating environments, filerefs can also be assigned by using system commands. For details, see the SAS documentation for your operating environment.

Examples

Example 1: Verifying that a Fileref is Assigned

This example tests whether the fileref MYFILE is currently assigned to an external file. A system error message is issued if the fileref is not currently assigned:

 %if %sysfunc(fileref(myfile))>0 %then     %put MYFILE is not assigned; 

Example 2: Verifying that Both a Fileref and a File Exist

This example tests for a zero value to determine if both the fileref and the file exist:

 %if %sysfunc(fileref(myfile)) ne 0 %then     %put %sysfunc(sysmsg()); 

See Also

Functions:

  • 'FEXIST Function' on page 526

  • 'FILEEXIST Function' on page 528

  • 'FILENAME Function' on page 529

  • 'SYSMSG Function' on page 847

Statement:

  • 'FILENAME Statement' on page 1169




SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 704

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net