- %macro test;
- %do i = 1 %to 5;
- %let x&i. = %scan(1 q 2 w 3,&i.);
- data collect;
- length x $20.;
- %if &i. > 1 %then %do;
- set collect end = last;
- output;
- if last then do;
- %end;
- x = "&&x&i..";
- i = &i.;
- output;
- %sysfunc(ifc(&i. > 1,end;,))
- run;
- %end;
- %mend;
- %test;
- Or:
- %macro test;
- %do i = 1 %to 5;
- %let x&i. = %scan(1 q 2 w 3,&i.);
- data collect;
- length x $20.;
- x = "&&x&i..";
- i = &i.;
- run;
- proc append base = all data = collect;
- quit;
- %end;
- %mend;
- %test;
也可以用SQL的insert来插值。


雷达卡




京公网安备 11010802022788号







