x**********0 发帖数: 163 | 1 I want to import multiple csv file
acc1990
acc1991
..
acc2010
I write a SAS macro like this
%MACRO importAcc (first=1990, last=2010);
%local year;
%do year=&first %to &last;
proc import datafile="C:\Users\acc&year..csv"
out=acc&year
dbms=csv
replace;
getnames=yes;
run;
%end;
%MEND importAcc;
%importAcc
But it is wrong and give back nothing, Can anybody help me with this? Thanks |
k*******a 发帖数: 772 | 2 为什么不敲全了 %importAcc (first=1990, last=2010); |
x**********0 发帖数: 163 | 3 就用default,就不用再加了吧
应该不是这个问题,试过了 |
f******u 发帖数: 250 | 4 当你run macro时,你没有赋值给macro, should be:
%importAcc(first=1990, last=2010)
【在 x**********0 的大作中提到】![](/moin_static193/solenoid/img/up.png) : I want to import multiple csv file : acc1990 : acc1991 : .. : acc2010 : I write a SAS macro like this : %MACRO importAcc (first=1990, last=2010); : %local year; : %do year=&first %to &last; : proc import datafile="C:\Users\acc&year..csv"
|
k*******a 发帖数: 772 | 5 %MACRO importAcc (first=1990, last=2010)
这一句 importAcc后面多了个空格,希望不是你粘帖错误 |
x**********0 发帖数: 163 | 6 谢谢大家,问题解决了,
确实有parameter的macro,有了default值也得在运行的时候注明的
那个多余的控格貌似没什么影响 |