1
我的程序下面出现了什么问题?我想导入几个excel文件并合并它们。 重命名在导入步骤中不起作用。更重要的是,即使创建了数据集y1和y2,合并也不起作用。 谢谢。在SAS中的宏中写入循环
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;
“不行”需要解释。我的猜测是你的变量名称不正确。我也认为你的宏不适合你想要的,因为n = 1的输出数据集将被n = 2覆盖。 – Joe
谢谢。它确实被覆盖。我固定它,可能不是最优雅或有效的方式,但它的工作。 – Betty