Accessing an External File or Device in UNIX Environments

To access an external file or device, you will need to specify its pathname or fileref in the appropriate SAS statements:


  • specifies the current output file for PUT statements.


  • includes a file containing SAS source statements into the Program Editor.


  • identifies an external file that you want to read with an INPUT statement.

In the SAS statement, refer to the file or device in one of two ways:

  • specify the pathnames for the files. For more information, see "Specifying Pathnames in UNIX Environments" on page 133.

  • assign a fileref to a device, one or more files, or a directory and use the fileref when you want to refer to the file or device.

In most cases, you will want to use a fileref.

What is a Fileref?

A fileref is nickname that you assign to a file or device. You simply assign the fileref once, and then use it as needed. Filerefs are especially useful when

  • the pathname is long and has to be specified several times within a program

  • the pathname might change. If the pathname changes, you need to change only the statement that assigns the fileref, not every reference to the file.

You can assign filerefs in the File Shortcuts window of the Explorer, with the FILENAME statement, with the FILENAME function, [1] or by defining the fileref as an environment variable.

[1] For a complete description of the FILENAME statement and the FILENAME function, see SAS Language Reference: Dictionary .

SAS 9.1 Companion for UNIX Environments
SAS 9.1 Companion For Unix Enivronments
ISBN: 1590472101
EAN: 2147483647
Year: 2004
Pages: 185
Authors: SAS Institute © 2008-2017.
If you may any questions please contact us: