Table 37.2 Referencing External Files Indirectly
External File
Task Tool Example
Assign a fileref
to a file that
contains input
data.
FILENAME
filename mydata 'input-file';
Assign a fileref
to a file for
output data.
FILENAME
filename myreport 'output-file';
Assign a fileref
to a file that
contains program
statements.
FILENAME
filename mypgm 'source-file';
Assign a fileref
to an output
device.
FILENAME
filename myprinter <device-type>
<host-options>;
Specify the file
that contains
input data.
INFILE
data weight;
infile mydata;
input idno $ week1 week16;
loss=week1-week16;
Specify the file
that the PUT
statement writes
to.
FILE
file myreport;
if loss ge 5 and loss le 9 then
put idno loss 'AWARD STATUS=3';
else if loss ge 10 and loss le 14 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
%include mypgm;
Referencing Many External Files Efficiently
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 enter 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 External Files Efficiently 757
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.235.62