I'm using SAS sql to create some macro variables for later use and printing of reports.
I am creating some summary variables (mean, min, max, etc.) by group.
The following code works for the first group, but does not create the macro variables for groups two and three.
data scores;
input trt t;
cards;
1 10
1 11
1 12
1 13
2 4
2 5
2 6
2 7
3 9
3 8
3 7
3 6
;
run;
%macro cdi;
%do i = 1 %to 3;
proc sql noprint;
select n(t), nmiss(t), mean(t), std(t), min(t), max(t)
into :n&i, :miss&i, :mean&i, :sd&i, :min&i, :max&i
from scores
where trt = &i;
quit;
%end;
%mend cdi;
%cdi;
***** this call shows the right values ;
%put &n1 &miss1 &mean1 &sd1 &min1 &max1 ;
***** this call produces error (symbolic reference not resolved) ;
%put &n2 &miss2 &mean2 &sd2 &min2 &max2 ;
I'm sure I'm missing something simple, but I haven't been able to see it yet...