PATHNAME Function


Returns the physical name of a SAS data library or of an external file, or returns a blank

Category: SAS File I/O

Category: External Files

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

Syntax

PATHNAME (( fileref libref ) <, search-ref >)

Arguments

fileref

  • specifies the fileref assigned to an external file.

libref

  • specifies the libref assigned to a SAS library.

search-ref

  • specifies whether to search for a fileref or a libref.

    F

    specifies a search for a fileref.

    L

    specifies a search for a libref.

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

Functions:

  • 'FEXIST Function' on page 526

  • 'FILEEXIST Function' on page 528

  • 'FILENAME Function' on page 529

  • 'FILEREF Function' on page 532

Statements:

  • 'LIBNAME Statement' on page 1284

  • '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