如何将多重插补整合到Donna Spiegelman中';s SAS子类型宏?
我试图在一项嵌套的病例对照研究中分析不同疾病亚型的HRs,该研究使用的数据集具有两个变量的高比例缺失值,我需要调整风险模型。对于未调整的模型,我使用了Donna Spiegelman的子类型宏 现在,我想使用带有分类变量a和b的多重插补数据的数据集运行一个调整后的模型。我的想法是首先运行Proc MI:如何将多重插补整合到Donna Spiegelman中';s SAS子类型宏?,sas,subtype,mi,Sas,Subtype,Mi,我试图在一项嵌套的病例对照研究中分析不同疾病亚型的HRs,该研究使用的数据集具有两个变量的高比例缺失值,我需要调整风险模型。对于未调整的模型,我使用了Donna Spiegelman的子类型宏 现在,我想使用带有分类变量a和b的多重插补数据的数据集运行一个调整后的模型。我的想法是首先运行Proc MI: proc mi data=Subtype nimpute=100 out=ImputSP seed=1305468 ; class a b disease_sub infection ; fc
proc mi data=Subtype nimpute=100 out=ImputSP seed=1305468 ;
class a b disease_sub infection ;
fcs plots=trace ( std mean );
var a b age disease_sub infection;
fcs discrim( a b /classeffects=include) nbiter=100;
run;
然后运行子类型宏的编辑版本,我在宏代码的3个部分中添加了“按插补”选项
/* get list of values of outcometype */
proc sort data=newdatname; by outcometype ; run;
proc means noprint data=newdatname; var outcometype;
output out=_expblist_ mean=m_outcometype;
by outcometype;
where outcometype ne . ;
run;
data _expblist_;
set _expblist_ end=_end_;
call symput('_eb_'||trim(left(_n_)), trim(left(m_outcometype)));
if _end_ then call symput ('_neb_', trim(left(_n_)));
run;
%if &studydesign eq CACO %then %do; %let reftype=0; %end;
ods listing close;
proc logistic data=newdatname outest=LL;
by _imputation_;
model outcometype(ref="&reftype")=&exposureND &exposureD_ &unconstrvar /link=glogit covb;
%if &studydesign eq CACA %then %do;
%do j=1 %to &_nexpND;
*variables for pair-wise LRT of heterogeneity test;
%do j=1 %to &_nexpND;
%do i=1 %to &_neb_;
if outcometype=&i then _expND_&j=&&_expND_&j._&i..;
%end;
rename _expND_&j=&&_expND_&j;
%end;
%do j=1 %to &_nexpD;
%do k=1 %to &&_nexpD_&j;
%do i=1 %to &_neb_;
if outcometype=&i then _expD_&j._&k=&&_expD_&j._&k._&i..;
%end;
rename _expD_&j._&k=&&_expD_&j._&k..;
%end;
%end;
%do j=1 %to &_nexpND;
%do i=1 %to %eval(&_neb_-1);
%do k=%eval(&i+1) %to &_neb_;
_expND_&j._&i._vs_&j._&k.= _expND_&j*(outcometype=&&_eb_&i|outcometype=&&_eb_&k);
%end;
%end;
%end;
%do j=1 %to &_nexpD;
%do i=1 %to %eval(&_neb_-1);
%do k=%eval(&i+1) %to &_neb_;
%do m=1 %to &&_nexpD_&j;
_expD_&j._&m._&i._vs_&j._&m._&k.=_expD_&j._&m.*(outcometype=&&_eb_&i|outcometype=&&_eb_&k);
%end;
%end;
%end;
%end;
run;
%end;
ods listing close;
proc phreg data=newdatname outest=LL %if "&covs" eq "YES" %then %do; covs %end; nosummary;
model (entrytime,time)*censoring(0)=
%do j=1 %to &_nexpND;
%do i=1 %to &_neb_;
_expND_&j._&i
%end;
%end;
%do j=1 %to &_nexpD;
%do k=1 %to &&_nexpD_&j;
%do i=1 %to &_neb_;
_expD_&j._&k._&i
%end;
%end;
%end;
%if "&augmented" eq "NO" %then %do;
%do j=1 %to &_nunconstrvar;
%do i=1 %to &_neb_;
_ucv_&j._&i
%end;
%end;
%end;
%else %if "&augmented" eq "YES" %then %do;
&unconstrvar
%end;
&constrvar / covb %if "&studydesign" eq "MCACO" | "&studydesign" eq "CACO" %then %do; ties=discrete %end; ;
%if "&studydesign" eq "COHORT" | "&studydesign" eq "CACO" %then %do; strata outcometype &stratavar; %end;
%if "&studydesign" eq "MCACO" %then %do; strata &matchid; %end;
by _imputation_;
在运行Subsubby_宏后,我打算运行此代码以获得最终估计:
proc print data=&PamEst (obs=8) ;
title "Logistic Model Coefficients First 8 Obs ";
var _Imputation_ Variable Estimate StdErr;
run;
TITLE "MULTIPLE IMPUTATION LOG REFRESSION-FCS";
proc mianalyze parms (classvar=ClassVal)=&PamEst ;
class &classmi ;
MODELeffects &modelvar ;
ods output ParameterEstimates=mianalyze_&PamEst;
run;
title;
data OR_&PamEst;
set mianalyze_&PamEst;
OR=exp (estimate);
LCL_OR=exp (LCLMean);
UCL_OR=exp(UCLMean);
proc print;
var parm &classmi OR LCL_OR UCL_OR;
run;
可悲的是,程序一步一步地压碎了子类型,我不知道如何最好地将多重插补整合到调整后的模型中。任何提示都将不胜感激 这在communities.sas.com上更好。在执行此操作之前,请添加'options mprint symbolgen;'请在程序顶部添加日志和数据以进行测试。