|
|
6#

楼主 |
发表于 2009-4-20 21:37:50
|
只看该作者
Re: 如何将macro变量 aaa的值 传递到数据集中
%let aaa=1 2 3 b b ccc we4356;
%macro AssignMcr;
%local i;
%let i=1;
data tblAssign;
length group $20.;*a safe length to assure read all components;
%do%while(%scan(&aaa,&i) ne %str( ));
%let nTransit = %scan(&aaa,&i);
group = "&nTransit";*group is a char;
output;
%let i=%eval(&i+1);
%end;
run;
%mend AssignMcr;
%AssignMcr
;
**** frist, i have to say that vicky1020 gave a very good answer and it is more effcient. my program is just for fun. if it works, the program can read char or numeric;if you need group being a numeric, just force it to convert and so on.
Thanks |
|