I am using the following code to generate a macro variable:
proc sql;
select count(*) into :Nobs
from table1;
select variable_list into :val1-:val%left(&Nobs)
from table1;
quit;
I would now like to use this variable list to subset a particular data set. I could do this with individual macro variables as follows:
data subset_data;
set original_data;
where variable = "&val1";
run;
My question is, in the where condition how could I check for all the values in the val array?
:val1-to indicate an unbounded list of macro variables. The automatic macro variable SQLOBS will have the count if you need it for something else. If you have an old version of SAS that does not support that syntax then just use an upper bound that is larger than any possible count.:var1-:var99999