What is wrong with my program below? I am trying to import several excel files and merge them. Rename does not work in the import step. More importantly, merge does not work even if datasets y1 and y2 are created. Thanks.
proc sort data=sourceh.caps;
by symbol;
run;
%MACRO RunProgram(month, year, n);
PROC Import DATAFILE= "D:\new\&month. &year. &n. min correlations.xls"
dbms=excel5 OUT= sourceh.y&n. (rename=(avcorr=y&n.)) replace;
GETNAMES=YES;
RUN;
data sourceh.testy&month.&year.;
merge sourceh.y&n. sourceh.caps;
by symbol;
drop number;
Month="&month.";
Year=&year.;
run;
%MEND;
%macro l;
%do n=1 %to 2;
%RunProgram(Jan, 12, &n);
%RunProgram(Apr, 12, &n);
%end;
%mend;
%l;