Dear community, I would please like to ask for your help concerning the following issue. Using proc sql in a loop, I want to filter out some variables based on their name. For example, I were to use proc sql noprint;
select
name
into
:namelist
separated by ' '
from
contents1
where
name like 'x%level&l.';
quit; from a data set, whose variable names I obtained via proc contents and safed them in "contents1". These variables are, say, 100 different x, defined over L, say, 50, different level, i.e., in the first step, %LET l=1, I want to filter out {x1level1, x2level1, ..., x100level1}, in the second step, %LET l=2, I want to filter out {x1level2, x2level2, ..., x100level2}, ..., in the 50th step, %LET l=50, I want to filter out {x1level50, x2level50, ..., x100level50} (i.e., I want to loop over the L levels, keeping all 100 x in each loop step). My problem is that due to the single quotes in the like statements, the macro variable, l, will not get resolved into 1, 2, ..., 50. Could you please provide me assistance on how to resolve this issue respectively achieve my goal? Yours sincerely, Sinistrum
... View more