Chapter Contents |
Previous |
Next |
SAS Companion for UNIX Environments |
FILENAME fileref directory-name; |
To refer to a file in the directory, specify the fileref
followed by the individual filename in parentheses. For example, you can refer
to the file
cars.dat
in
the directory
/users/pat
as shown in this example:
filename prices '/users/pat'; data current.list; file prices(cars); ...other SAS statements... run;
You can also use aggregate syntax with filerefs that have been defined using environment variables (see Using Environment Variables to Assign Filerefs). For example:
x setenv PRICES /users/pat; data current.list; file prices(cars); ...other SAS statements... run;
Assigning a Fileref to Several Directories |
In the FILENAME statement, you can concatenate directory names and use the fileref to refer to any file within those directories:
FILENAME fileref ("directory-1" ... "directory-n"); |
report.sas
file resides in the directory associated with the MYPROGS
environment variable. When the SAS System executes the following code, it
searches for
report.sas
in the pathnames that are specified in
the FILENAME statement and it executes the program.
filename progs ("$MYPROGS" "/users/mkt/progs"); %inc progs(report);
The SAS System searches the pathnames in the order specified in the FILENAME statement until
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.