/* 创建一个包含以下变量的数据集:
暴露 (分类变量,1为暴露,0为未暴露)
疾病 (分类变量,1为患病,0为健康)
混杂因素1 (连续变量)
混杂因素2 (分类变量)
*/
data mydata;
input exposure disease confounder1 confounder2;
datalines;
1 1 10 0
1 1 15 1
1 0 20 0
0 1 5 1
0 0 12 0
0 0 8 1
;
run;
/* 使用Poisson回归模型计算调整的相对风险 */
proc genmod data=mydata;
class exposure confounder2;
model disease = exposure confounder1 confounder2 / dist=Poisson link=log type3;
estimate "RR" exposure 1 0/ exp ;
run;
Done!