Functions and CALL Routines |
Category: | SAS File I/O |
Category: | External Files |
See: | PATHNAME Function under UNIX OpenVMS z/OS |
Syntax | |
Arguments | |
Details | |
Examples | |
See Also |
Syntax |
PATHNAME((fileref | libref) <,search-ref>) |
is a character constant, variable, or expression that specifies the fileref that is assigned to an external file.
is a character constant, variable, or expression that specifies the libref that is assigned to a SAS library.
is a character constant, variable, or expression that specifies whether to search for a fileref or a libref.
F | |
L |
Details |
PATHNAME returns the physical name of an external file or SAS library, or blank if fileref or libref is invalid.
If the name of a fileref is identical to the name of a libref, you can use the search-ref argument to choose which reference you want to search. If you specify a value of F, SAS searches for a fileref. If you specify a value of L, SAS searches for a libref.
If you do not specify a search-ref argument, and the name of a fileref is identical to the name of a libref, PATHNAME searches first for a fileref. If a fileref does not exist, PATHNAME then searches for a libref.
The default length of the target variable in the DATA step is 200 characters.
You can assign a fileref to an external file by using the FILENAME statement or the FILENAME function.
You can assign a libref to a SAS library using the LIBNAME statement or the LIBNAME function. Some operating environments allow you to assign a libref using system commands.
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 |
This example uses the FILEREF function to verify that the fileref MYFILE is associated with an external file. Then it uses PATHNAME to retrieve the actual name of the external file:
data _null_; length fname $ 100; rc=fileref('myfile'); if (rc=0) then do; fname=pathname('myfile'); put fname=; end; run;
See Also |
| |||||||||
|
Copyright © 2011 by SAS Institute Inc., Cary, NC, USA. All rights reserved.