@David_Billa wrote:
I ran the code below and I got 'odsnumber' value as 19 and what I except is 20.
%macro test;
%let i=1;
data test&i.;
set sashelp.class(obs=1);
run;
%let i=2;
data test&i.;
set sashelp.class;
run;
proc sql noprint;
select nobs
into :odsnumber trimmed
from sashelp.vtable
where libname = 'WORK' and memname = "TEST&i."
;
quit;
%put &odsnumber.;
%mend;
%test;
You ONLY "counted" from "Test&i" when &I=2. So you only get the 19 from the second created data set.
You might have been thinking about something similar to and memname like "%TEST%" or maybe substr(memname,1,4)="TEST" but the equals comparison only is going to look at a single value. That single value would have to be something that is not the data set complete name to find two data set values.
... View more