全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
923 0
2017-01-11
新手小白,想写了一个小的macro程序自动检查confounder,但想在程序中加下面的data能功,却不能成功,请教各位大神

%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;

多谢大家了!!!


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群