1. use proc sql to select the values you want put into the macro. These values will appear in the output window.
2. creat a macro variable , say list. Then copy and past the values selected above values after the sign.
%let list =
3. in the data step, create an array to hold the values of macro.
The following code are what I used. Hope you can modify it for your use.
/* define a macro variable */
%let List = var1 var2 var3 var4 var5 var6 var7 var8 var9 var10
var11 var12 var13 var14 var15 var16 var17 var18 var19 var20 var21 var22 var23 var24
var25 var26 var27 var28 var29 var30;
%put _user_;
data DATA_3;
array d_compont &list; /* to create an array holding the variables */
set data2008;
nd=0;
do i = 1 to 30;
DD = d_compont(i);
if DD not in (1 2 3 4 5) then nd=nd+1;
end;
run;
[此贴子已经被作者于2008-7-22 4:30:19编辑过]