Specifying Pathnames in UNIX Environments


Rules for Specifying Directory and Pathnames

Whether you specify a data file name directly in the various SAS statements or specify the data library name in a LIBNAME statement and then refer to the libref, the same rules apply for specifying UNIX directory and file pathnames.

Specify directory and file pathnames in quotation marks. The level of specification depends on your current directory.

Example 1: Accessing a File that is Not in the Current Directory

If /u/1999/ budgets is not your current directory, then to access the data file named May, you must specify the entire pathname:

 data '/u/1999/budgets/may'; 

If you wanted to use a libref, you would specify:

 libname budgets '/u/1999/budgets';   data budgets.may; 

Example 2: Accessing a File in the Current Directory

If /u/1999/budgets is your current directory, you could specify only the data file names :

 data 'quarter1';   merge 'jan' 'feb' 'mar';   run; 
Note  

If you omit the quotation marks, then SAS assumes that these data sets are stored in the Saswork directory.

If you wanted to use a libref, you would specify:

 libname budgets '.';   data budgets.quarter1;   merge budgets.jan budgets.feb budgets.mar;   run; 

Valid Character Substitutions in Pathnames

You can use the character substitutions shown in the following table to specify pathnames.

Table 4.6: Character Substitutions in Pathnames

Characters

Meaning

~/

$HOME/

Can be used only at the beginning of a pathname.

~ name /

name 's home directory (taken from file /etc/passwd ). Can be used only at the beginning of a pathname.

! sasroot

name of sasroot directory (see Appendix 1, "The !SASROOT Directory," on page 397). Specified only at the beginning of a pathname.

.

current working directory

..

parent of current working directory

$ VARIABLE

environment variable VARIABLE




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

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