Chapter Contents

Previous

Next
SAS Companion for UNIX Environments

Specifying 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 quotes. The level of specification depends on your current directory. For example, 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;
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 Character Substitutions in Pathnames to specify pathnames.

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 The sasroot Directory). Specified only at the beginning of a pathname.
. current working directory
.. parent of current working directory
$VARIABLE
environment variable VARIABLE


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.