I recently had a set of five or so such files, so instead of loading each individually, I built a macro to load, append, load, append, etc.
It's not a plug 'n play macro, since adjusting the variables, formats, and base_data_set are required, but here's the skeleton of it:
/*
Load a series of files, and append them to the base dataset.
*/
%macro append(fname);
data temp;
infile &fname dsd truncover;
input
var1 format1.
var2 format2.; ;
run;
proc append base=base_data_set data=temp;
run;
%mend append;
/*
Load and append 5 files..
*/
%append("file1.csv");
%append("file2.csv");
%append("file3.csv");
%append("file4.csv");
%append("file5.csv");
This is a lot cleaner than writing a separate data step and append proc for each new file!
No comments:
Post a Comment