Using SAS 9.4.
I have the following code. Is there a way to edit the macro to enable a list of xvars instead of having to list each new xvar? I have 20+ variables and it would be nice to not have to write those out. Thank you
%macro getChiFish(data=, xvar=, grpvar=, outDat=);
proc freq data=&data noprint;
Tables &xvar * &grpvar/ missing nocum chisq fisher nopercent norow;
output out=tmpDat n nmiss pchi lrchi fisher ;
run;
%LET tmpvar = &xvar;
data &outDat;
set tmpDat (keep = P_PCHI XP2_FISH);
varN = symget('tmpvar');
run;
%mend getChiFish;
%getChiFish(data=para.analysis, xvar=sex, grpvar=recur, outDat=pval1)
%getChiFish(data=para.analysis, xvar=race, grpvar=recur, outDat=pval2)
%getChiFish(data=para.analysis, xvar=procedureid, grpvar=recur, outDat=pval3)
%getChiFish(data=para.analysis, xvar=proc_technique, grpvar=recur, outDat=pval4)
%getChiFish(data=para.analysis, xvar=smoke, grpvar=recur, outDat=pval5)
... View more