Dear all, I have written code to conduct multiple imputation per guidance here: https://stats.idre.ucla.edu/sas/seminars/multiple-imputation-in-sas/mi_new_1/. I cannot complete the final, 3rd stage of the imputation process--i.e. pooling of estimates from imputations-- because in stage 2 I cannot successfully output the estimates to be pooled. The problematic code and resulting errors messages are in red/bold below. Please help-- thank you!!
/*1. imputation phase*/
proc mi data=siya nimpute=20 out=mi_fcs;
class share give receive agyw drugs depression
ss worksite mobility pimp homeless money unsafe
disclose vs ed civil alcohol violrec viol;
fcs plots=trace(mean std);
var share give receive agyw drugs depression
ss worksite mobility pimp homeless money unsafe
disclose estigmasw estigmahiv astigmasw
astigmahiv pills303 pillsreceive303
pillsgive303 vs ed civil alcohol violrec viol ;
fcs discrim(share give receive agyw drugs depression
ss worksite mobility pimp homeless money unsafe
disclose vs ed civil alcohol violrec viol / classeffects=include) nbiter=100;
run;
/*2. analysis */
/*model 1*/
proc genmod data=mi_fcs;
class pid civil (ref="0") depression (ref="0")
alcohol (ref="0") ed (ref="0") mobility (ref="0") unsafe (ref="0") money (ref="0") worksite (ref="0") /param=ref;
model vs=
pills303
agyw
ed
civil
alcohol
drugs
depression
mobility
worksite
pimp
violrec
homeless
money
unsafe
estigmasw
estigmahiv
astigmasw
astigmahiv disclose/Dist=poisson Link=log;
Repeated subject = pid / type=Ind;
estimate 'pills303' pills303 1;
by _imputation_;
ods output ParameterEstimates=gm_fcs;
title 'VS on pills given and/or received with MI';
run;
Above receives message: "WARNING: Output 'ParameterEstimates' was not created. Make sure that the output object name, label, or path is spelled correctly. Also, verify that the appropriate procedure options are used to produce the requested output object. For example, verify that the NOPRINT option is not used."
Therefore I cannot complete following, phase 3, because GM_FCS does not exist.
/*3. pooling phase*/
TITLE " MULTIPLE IMPUTATION Linear REGRESSION - FCS";
PROC MIANALYZE parms(classvar=level)=gm_fcs;
class share give receive agyw drugs depression
ss worksite mobility pimp homeless money unsafe
disclose vs ed civil alcohol violrec viol;
MODELEFFECTS INTERCEPT share give receive agyw drugs depression
ss worksite mobility pimp homeless money unsafe
disclose estigmasw estigmahiv astigmasw
astigmahiv pills303 pillsreceive303
pillsgive303 vs ed civil alcohol violrec viol;/*all variables from all models*/
RUN;
According to the PROC GENMOD documentation, you need the PRINTMLE option to obtain the parameter estimates when you use a REPEATED statement.
thank you so much. That enabled me to complete stage 2 of multiple imputation, but now I cannot get through the third and final pooling stage because when I run the code (see "/*3. pooling phase*/" in original post), SAS gets hung up running and never competes the procedure. Any ideas of how to fix this? Thanks! There are just 890 observations in the dataset.
Hi team, I've used the below code for multiple imputation.
After doing imputation, I'm running multinomial logistic regression then running proc analyse.
proc mi data=data.newdata seed=876 nimpute=5 out=outfcs;
class group sex hispan;
fcs nbiter=40 logistic (group/details);
var group sysbp01 diabp01 a1c_01 chol_01 bmi_01 sex hispan;
run;
proc logistic data = outfcs; class group (ref = "3") sex (ref = "0") hispan (ref= "1") / param = ref; model group = sysbp01 diabp01 a1c_01 chol_01 bmi_01 age01 sex hispan / link = glogit covb;
by _Imputation_; ods output ParameterEstimates=lgsparms CovB=lgscovb;
run;
proc mianalyze parms (classvar=classval)=lgsparms; class sex hispan; modeleffects intercept sysbp01 diabp01 a1c_01 chol_01 bmi_01 age01 sex hispan ; run;
And getting only pooled/combined estimates. But I need relative estimates.
Thank you.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.