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.
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;
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;
You can use the character substitutions shown in the following table to specify 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 |