&t=(a1 a2 a3 a4... a28 a30),问题就在于i=1,2,3,...,28,30 没有29(也就是没有a29),这种情况如何解决?
谢谢!作者: shiyiming 时间: 2012-2-10 18:02 标题: Re: 请教一个do loop的问题 或许这是你想要的
[code:74pb37nx]data a;
x=1;
run;
%macro hope(t=);
%let i=1;
%let subt=%scan(&t,1,%str( ));
%do %until(&subt eq);
data ds_&subt;
set a;
run;
%put ERROR-DATA SET %upcase(&subt) CREATED!;
%let i=%eval(&i+1);
%let subt=%scan(&t,&i,%str( ));
%end;
%mend;
%hope(t=a1 a2 a5)[/code:74pb37nx]作者: shiyiming 时间: 2012-2-20 17:13 标题: Re: 请教一个do loop的问题 你的表的列表里面就没有29啊,所以没出来是正常的,不知道你想做什么。作者: shiyiming 时间: 2012-2-21 09:18 标题: Re: 请教一个do loop的问题 right, but an ERROR message will show up in SAS log(ERROR message is not allowed by a regualation), and I just wonder how to modify the SAS code to run the code without ERROR message(if 29 is missing).
thanks.作者: shiyiming 时间: 2012-2-21 13:50 标题: Re: 请教一个do loop的问题 一般情况下不用你那种确定的循环次数,可以用do while,do until等判断是否还有东西可以读,或者先判断你的表列表中有多少个需要处理。