When you use many
files from a single aggregate storage location, such as a directory
or partitioned data set (PDS or MACLIB), you can use a single fileref,
followed by a filename enclosed in parentheses, to access the individual
files. This saves time by eliminating the need to type a long file
storage location name repeatedly. It also makes changing the program
easier later if you change the file storage location. The following
table shows an example of assigning a fileref to an aggregate storage
location:
Referencing Many Files Efficiently
|
|
|
Assign a fileref to
aggregate storage location.
|
|
filename mydir 'directory-or-PDS-name';
|
Specify the file that
contains input data.
|
|
data weight;
infile mydir(qrt1.data);
input idno $ week1 week16;
loss=week1-week16;
|
Specify the file that
the PUT statement writes to. 1
|
|
file mydir(awards);
if loss ge 5 then put idno loss
'AWARD STATUS=3';
else if loss ge 10
then put idno loss 'AWARD STATUS=2';
else if loss ge 15
then put idno loss 'AWARD STATUS=1';
run;
|
Bring statements or
raw data from another file into your SAS job and execute them.
|
|
%include mydir(whole.program);
|
1SAS creates a file that
is named with the appropriate extension for your operating environment.
|