Programming the statistical procedures from SAS

proc mi

Posts: 26

proc mi

[ Edited ]



I have quite a basic question regarding multiple imputation using proc mi, partly due to my lack of understanding of the available material online. I am trying to replicate an imputation method used by another researcher, unfortunately they were not able to help me because they used Stata for their analyses.


I wonder if my codes are correct and have some questions too.


My dataset has the following variabes: patid, elapsed_time, change_in_bmi, gender, age, weight(for the model).

The missing values are in change in bmi.


I want to fit a weighted least squares linear regression model as an imputation model. The outcome is change in BMI, which is regressed against elapsed time (fitted as 3-knot spline) with interactions between the time function and age, and between the time function and sex. 


I have used the following codes is below,

but my question is 1. Is there a way to be able to fit my time function as a spline in the proc mi command, and 2. Do I just need to take the mean of my 13 imputations to get the final imputed dataset? (is there a specific code that does this?)


Thank you for your time in advance.


proc mi data=have out=model nimpute=13 seed=2577;
class gender;
fcs reg(changeinbmi=elapsedtime elapsedtime*gender elapsedtime*age);
var gender age elapsedtime changeinbmi;

proc glimmix data=model;
effect timespl=spline(elapsedtime/knotmethod=equal(3));
class gender;
model changeinbmi=timespl timespl*gender timespl*age / solution covb;
weight wgt;
ods output parameterestimates=glmparms covb=cov;
by _Imputation_;

proc mianalyze parms=glmparms;
class gender;
modeleffects intercept timespl timespl*gender timespl*age;


Ask a Question
Discussion stats
  • 0 replies
  • 1 in conversation