Table 37.3 Referencing Many Files Efficiently
External File Task Tool Example
Assign a fileref to aggregate
storage location.
FILENAME
filename mydir 'directory-or-PDS-name';
Specify the file that contains
input data.
INFILE
data weight;
infile mydir(qrt1.data);
input idno $ week1 week16;
loss=week1-week16;
Specify the file that the PUT
statement writes to.
*
FILE
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
%include mydir(whole.program);
*
SAS creates a file that is named with the appropriate extension for your operating environment.
Referencing External Files with Other Access
Methods
You can assign filerefs to external files that you access with the following FILENAME
access methods:
• CATALOG
• DATAURL
• FTP
• Hadoop
• SFTP
• TCP/IP SOCKET
• URL
• WebDAV
• ZIP
Examples of how to use each method are shown in the following table:
758 Chapter 37 • External Files