Sorry to bother again after this question is marked as "Solved". @ChrisNZ Do you think I might be able to use X of T2 in their original compact format? Below are the sample input datasets. data input;
input hist $;
cards;
100
105
110
110
;
data in2;
length hist $15.;
input hist label;
cards;
100-105,108 1
110 3
;
run; I was thinking of using each row of IN2 in their exact compact format if hist in (100-105,108) In your previous post, your way was to do it in 2 steps, if 100<=hist<=105
if hist=108 I try to do this because the dataset I work with is complicated and it takes really long to loop through all the combinations. To give you a general idea, some rows look like this(columns in the red circle correspond to the "X" and "Y" in your T2 dataset). And I have 136 rows of data in this format. I tried to write something similar to what's in your previous post: data test;
set input;
RC=dosubl(cats('data _null_; '
,' set in2; '
,'call symput("hist_list",hist); '
,'if ', hist, ' in (&hist_list) then do;'
,'call symputx("lab",label); '
,'stop; '
,'call symputx("lab"," "); '
,'run; '));
label=symget('lab');
run; But things didn't work out so well. Again, thank you so much for all the help and inspiration!
... View more