@mk5
Always try to first write your code without macro and only when that works wrap macro code around. As others already wrote: SAS Macros don't process SAS tables. They are mainly use to implement dynamic code.
Here a way to go:
%macro ttest2(dsn= , quantvar= , catvar= , siglev= , doplot= );
data _null_;
set &dsn end=last;
array _NonMiss [2] 8 _temporary_;
_NonMiss[1]=sum(_NonMiss[1],missing(&quantvar) = 0);
_NonMiss[2]=sum(_NonMiss[2],missing(&catvar) = 0);
if last then
do;
call symputx('s1',_NonMiss[1], l);
call symputx('s2',_NonMiss[2], l);
end;
run;
%if (%eval(&s1 < 30) or %eval(&s2 < 30)) %then
%do;
title2 "Warning: sample sizes of &quantvar and &catvar may be too small for valid inference";
%end;
%else
%do;
title2 "all good";
%end;
proc print data=sashelp.class(obs=1);
run;
%mend;
data sampleDS1 sampleDS2;
set sashelp.class;
if _n_>10 then call missing(age);
output; output;
output sampleDS2;
run;
%ttest2(
dsn=sampleDS1 ,
quantvar=age ,
catvar=name
);
%ttest2(
dsn=sampleDS2 ,
quantvar=age ,
catvar=name
);
... View more