/* Reads a file into a macro var. CANNOT BE INCLUDED WITHIN A DATA STEP. Usage: %include '/pub/sas/macros/readfile.sas'; %readfile('path-to-file'); %let xxx = &filecontents; *or do whatever with it; */ %macro readfile(fname); %global filecontents; filename in_file &fname ; data _null_; length text $32767; retain text ''; infile in_file flowover dlmstr='//' end=last; input; text=cats(text,_infile_); if last then call symput('filecontents',text); run; %mend readfile;