Hello!
I am trying to do a multiple imputation. In my proc mi step, I am including all variables in my dataset that I would like to analyze. The only variable with missing data is "hei2015_total_score", which is continuous. Next, I used a general linear model to investigate one of my outcomes of interest. However, the "Parameter estimate" is not created. I get the following error message " NOTE: Interactivity disabled with BY processing.
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.
I have attached my code below. Thank you in advance for your help!
proc mi data=mri2 out= impute_mri;
class new_educ vfat_q sat_q pfat_q plean_q race new_smoke hrtassign exercise diabetes cvdisease htn hrt_hx;
var log_wm log_temporal_wm log_parietal_Wm log_occipital_WM log_frontal_WM
log_enor_cortex hippocampal_volume total_brain_volume grey_matter precuneus amygdala
cingulate_region vfat_q sat_q pfat_q plean_q new_educ race new_smoke hrtassign exercise diabetes
cvdisease htn hrt_hx ICV_cc age mri_dy alcswk hei2015_total_score;
fcs reg(hei2015_total_score);
run;
proc glm data=impute_mri;
class new_educ vfat_q race new_smoke hrtassign exercise diabetes cvdisease htn hrt_hx;
model cingulate_region= vfat_q new_educ race new_smoke hrtassign exercise
diabetes cvdisease htn hrt_hx ICV_cc hei2015_total_score age mri_dy alcswk;
lsmeans vfat_q /pdiff stderr om cl cov;
by _imputation_;
ods output ParameterEstimates= imputemri2;
run;
proc mianalyze parms=imputemri2 ;
class new_educ vfat_q race new_smoke hrtassign exercise diabetes cvdisease htn hrt_hx;
modeleffects intercept ICV_cc hei2015_total_score age mri_dy alcswk new_educ vfat_q race new_smoke hrtassign exercise diabetes
cvdisease htn hrt_hx;
run;
Hello @zaldarsa,
The note about interactivity just informs you that you can't use PROC GLM interactively in this situation (see Using PROC GLM Interactively), which you didn't intend anyway.
When you see that warning about ODS output datasets not created without an obvious reason (like a misspelled object name or the NOPRINT option) you should refer to the section ODS Table Names under "Details" in the procedure documentation (same place for virtually all statistical procedures). In your particular case you'll find out that the ParameterEstimates object requires the SOLUTION option of the MODEL statement if classification effects are involved (which is the case as you have a CLASS statement). I hope that adding this option will resolve the issue because I can't say much about the PROC MI and PROC MIANALYZE steps.
model cingulate_region= vfat_q new_educ race new_smoke hrtassign exercise diabetes cvdisease htn hrt_hx ICV_cc hei2015_total_score age mri_dy alcswk / solution;
By default, PROC GLM does not create a ParameterEstimates table. You need to add the SOLUTION option at the end of the MODEL statement:
proc glm data=impute_mri;
class new_educ ...;
model cingulate_region= vfat_q ... alcswk / SOLUTION;
...
ods output ParameterEstimates= imputemri2;
quit;
Because PROC GLM is an interactive procedure, you should get in the habit of using the QUIT statement with PROC GLM. The ODS tables are not output until the procedure exits.
Even after correcting the omission of the SOLUTION option, you will still need to make a modification of the ParameterEstimates data set in order to have MIANALYZE read it in correctly. You should follow the example in the usage note linked below.
48700 - Additional examples of combining PROC GLM results in PROC MIANALYZE (sas.com)
Hi! So I did look into that example, and several others but I am still a bit confused. Since I am interested in the least square means for the variable vfat_Q, should my code look something like this? I'm not too sure if I'm on the right track and what my next steps should be to fill in the missing values for non imputed cells.
proc glm data=impute_mri;
class new_educ vfat_q race new_smoke hrtassign exercise diabetes cvdisease htn hrt_hx;
model cingulate_region= vfat_q new_educ race new_smoke hrtassign exercise
diabetes cvdisease htn hrt_hx ICV_cc hei2015_total_score age mri_dy alcswk/solution;
lsmeans vfat_q /pdiff stderr om cl cov;
by _imputation_;
ods output lsmeans= lsm;
run; quit;
proc mianalyze data=lsm;
ods output parameterestimates=ls_means;
modeleffects lsmean;
stderr stderr;
run;
You will need to sort the LsMeans data set and then run MIANALYZE BY VFAT_Q. See this example as a template.
If you are also looking to combine the differences then you can follow this example as well by looking at the second example on the page.
Thank you for sharing this template, it has been quite helpful. However, when i try to run the proc mianalyze now the following error message occurs:
At least two imputations are required for PROC MIANALYZE.
Data set WORK.LSM is not sorted in ascending sequence. The current BY group has vfat_q = Q4
and the next BY group has vfat_q = Q1.
I don't understand why its giving this message if there are 25 imputations.
proc mi data=mri2 out= impute_mri;
class new_educ vfat_q sat_q pfat_q plean_q race new_smoke hrtassign exercise diabetes cvdisease htn hrt_hx;
var log_wm log_temporal_wm log_parietal_Wm log_occipital_WM log_frontal_WM
log_enor_cortex hippocampal_volume total_brain_volume grey_matter precuneus amygdala
cingulate_region vfat_q sat_q pfat_q plean_q new_educ race new_smoke hrtassign exercise diabetes
cvdisease htn hrt_hx ICV_cc age mri_dy alcswk hei2015_total_score;
fcs reg(hei2015_total_score);
run;
proc mixed data=impute_mri;
class new_educ vfat_q race new_smoke hrtassign exercise diabetes cvdisease htn hrt_hx;
model cingulate_region= vfat_q new_educ race new_smoke hrtassign exercise
diabetes cvdisease htn hrt_hx ICV_cc hei2015_total_score age mri_dy alcswk/solution;
lsmeans vfat_q /diff;
by _imputation_;
ods select lsmeans ;
ods output lsmeans= lsm ;
run; quit;
proc sort data=lsm; by _imputation_ vfat_q ; run;
proc mianalyze data=lsm;
by vfat_q;
modeleffects estimate;
stderr stderr;
run;
Check the ordering on the BY statement in Proc SORT. You should first sort by the analysis variable.
proc sort data=lsm; by vfat_q _imputation_; run;
Thank you so much , it worked! I do have one last question. I would like to use the proc mianalyze procedure to a Pr>F value associated with vfat_q from the Type 3 test of fixed effects. My proc minalyze code isn't working.
proc mixed data=impute_mri;
class new_educ vfat_q race new_smoke hrtassign exercise diabetes cvdisease htn hrt_hx;
model cingulate_region= vfat_q new_educ race new_smoke hrtassign exercise
diabetes cvdisease htn hrt_hx ICV_cc hei2015_total_score age mri_dy alcswk;
lsmeans vfat_q /diff;
by _imputation_;
ods output lsmeans= lsm tests3=type3test;
run; quit;
proc sort data=type3test; by effect _imputation_ ; run;
proc mianalyze data=type3test;
class effect;
modeleffects effect;
run;
You need to add a TEST statement:
proc mianalyze data=type3test;
class effect;
modeleffects effect;
test effect;
run;
All of the examples in the documentation for the TEST statement look like they are for a regression on continuous variables though, so I am not sure this is the correct syntax for a categorical variable. If the code doesn't work (and I am guessing it may not which is why I am editing my response), then you will probably need to use an ODS output statement to get the parameter estimates and the covariance matrix, and then hand calculate (DATA step or PROC IML) the F test.
Using my friend Mr. Google, I found this link on Paul Allison's site: https://www.sas.upenn.edu/~allison/combchi.sas The COMBCHI macro requires PROC IML, so if that is not available to you, then this method wouldn't be an option.
BarbClothier presents a dummy variable approach in this thread: Proc Mianalyze: obtaining combined results for cat... - SAS Support Communities. This approach will allow for the use of the TEST statement, but be prepared to edit the COVB dataset.
SteveDenham
Unfortunately there is not a good way currently to combine Type3 tests, especially when they follow an F-distribution. MIANALYZE will not allow you to use a TEST statement with a CLASS variable so that approach won't work directly.
One option would be to dummy code the CLASS variable prior to running MIXED and then use a TEST statement in MIANALYZE on the dummy variables.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.