%macro confounder( yvar= , xvar= ,covars=,catvars=);
*build base model the get the coefficient;
proc genmod data=analysis ;
class ind &catvars(ref="0")/param=ref;
model &yvar = &xvar /dist=normal;
repeated subject=Ind /corr=unstr corrw;
ods output GEEEmpPEst=parm (keep=Parm estimate where=(parm="&xvar"));
title2 "based model for estimate the confounder";
run;
*add each confounder into the model;
proc genmod data=analysis ;class ind &catvars(ref="0")/param=ref ;
model &yvar = &xvar &covars /dist=normal;
repeated subject=Ind /corr=unstr corrw;
title3 "covars in model = &covars";
ods output GEEEmpPEst=adparm (keep=Parm estimate where=(adparm="&xvar"));
run;%mend confounder;
---------------------------------------------------------------------------------------------------------
想加入的data部分
*merge the two estimate of beta together;
data adparm;
set adparm;
rename estimate=adestimate;
run;
data adjust;
merge parm adparm;
differ=abs((adestimate-estimate)/estimate));
if differ>=0.15 then confounder=1;
else confounder=0;
run;
proc print data=adjust;
run;
多谢大家了!!!