i have a list of excel files to be imported and has to be consolidated in a big file.
the file name are in the format customer data file 2016-04,2016-03 and so on.
first i have tried
%MACRO import(filename); proc import datafile="&&loc&filename " out=cust%sysfunc(compress(&filename.)) dbms=excel replace; run; %MEND;
%import(2016-14); proc print;run;
but i want to automate it further and thats where i am getting stuck
%let loc=C:\Users\user\Downloads\New folder\Customer Data File;
%MACRO importfile(filename);
%do i=1 to 60; data _null_;
data files; callsymput("filename",put("042016"d, yymm7.)); run;
%if filename=filexist("&&loc.&filename.xls");
proc import datafile="&&loc. &filename" out=c%sysfunc(compress(&filename.)) dbms= excel replace; run;
data final; set final&filename. ; run; %end;
%MEND;
%importfile(04-2016);
... View more