Using SAS Files |
Rules for Specifying Directory and Pathnames |
Whether you specify a data filename directly in the various SAS statements, or you specify the 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.
If /u/2007/budgets is not your current directory, then to access the data file named May, you must specify the entire pathname:
data '/u/2007/budgets/may';
If you wanted to use a libref, you would specify:
libname budgets '/u/2007/budgets'; data budgets.may;
If /u/2007/budgets is your current directory, you could specify only the filenames:
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 in the following table to specify pathnames.
Characters | Meaning |
---|---|
~/ | $HOME/ |
~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 The !SASROOT Directory). Specified only at the beginning of a pathname. |
. | current working directory. |
.. | parent of current working directory. |
$VARIABLE |
environment variable VARIABLE. |
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.