Chapter Contents |
Previous |
Next |
FILEREF |
Category: | External File |
Syntax | |
Details | |
Examples | |
Example 1: Determining Whether a Fileref Has Been Assigned to an External File | |
Example 2: Determining Whether a Fileref and Its File Exist | |
See Also |
Syntax |
sysrc=FILEREF(fileref); |
0 | Both the fileref and the external file exist. |
< 0 | The fileref has been assigned, but the file that it points to does not exist. |
> 0 | The fileref has not been assigned. |
Type: Numeric
Type: Character
Details |
A negative return code indicates that the fileref exists but that the physical file associated with the fileref does not exist. A positive, nonzero value indicates that the fileref has not been assigned.
A fileref can be assigned to an external file by using the FILENAME statement or the FILENAME function in SCL. Under some operating systems, you can also use system commands to assign filerefs. See the SAS documentation for your operating environment.
Examples |
Test 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 (fileref('myfile') > 0) then _msg_=sysmsg();
Test the fileref MYFILE to determine whether the fileref is assigned and whether the file that it refers to exists:
if (fileref('myfile') ne 0) then _msg_=sysmsg();
See Also |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.