Fileref in macro

filename and %inc

You can access several files or members from this storage location by listing them in parentheses after the fileref in a single %INCLUDE statement. Separate filenames with a comma or a blank space. The following %INCLUDE statement demonstrates this method:

filename student ‘/data/student/home/files/’;
%inc student(sasprog1);
%inc student(sasprog2);
%inc student(sasprog3);

%inc student(sasprog1, sasprog2, sasprog3);

If you associate a fileref with an aggregate storage location, use the fileref, followed in parentheses by an individual filename, to read from or write to any of the individual external files that are stored there.
In this example, each DATA step reads from an external file (REGION1 and REGION2, respectively) that is stored in the same aggregate storage location and that is referenced by the fileref SALES.

filename sales ‘aggregate-storage-location’;

data total1;
infile sales(region1);
input machine $ jansales febsales marsales;
totsale=jansales+febsales+marsales;
run;

data total2;
infile sales(region2);
input machine $ jansales febsales marsales;
totsale=jansales+febsales+marsales;
run;