Hi all,
I'd like some help understanding a WARNING I'm receiving from proc MI when shifting imputations according to some classification variable (i.e. different shifts by different levels of the class variable).
My understanding of the code below is that I have called proc MI twice and using the same imputation model (one fit using all the data which depends only on the TRT variable) I have adjusted the MAR imputations by some shift (on the log-odds scale in this case because the model is an ordered logistic model).
I do not understand why a WARNING would be given, apparently because the observations selected for adjustment all have a missing outcome value. I think there is a single imputation model. Why does it matter if the adjustments to a selection of observations happen to be unique to variables with a missing outcome? And the imputation appears to still be correctly performed despite the WARNING?
Can anyone shed light on this?
Thank you!
/*create some data to illustrate the WARNING*/ data dsin; call streaminit(1); do USUBJID=1 to 200; if rand("UNIFORM") gt 0.2 then AVAL = rand("BINOMIAL", 0.5, 2); else AVAL=.; TRT = mod(USUBJID, 2); select; when (TRT=0) do; IMPLEVEL1="IMP0"; IMPLEVEL2="IMP0 "; end; when (AVAL=. and TRT=1) do; IMPLEVEL1="IMP1"; IMPLEVEL2="IMP1a"; end; when (AVAL ne . and TRT=1) do; IMPLEVEL1="IMP1"; IMPLEVEL2="IMP1b"; end; end; output; end; run; /*This imputation shifts log odds of event=2 by 1 in TRT=0 and by 2 in TRT=1 arm compared to an MAR imputation?*/ proc mi data=dsin out=filled1 nimpute=10000; class AVAL TRT IMPLEVEL1; var TRT AVAL; monotone logistic(AVAL = TRT); mnar adjust(AVAL(event="2") / ADJUSTOBS= (IMPLEVEL1="IMP0") shift=1) adjust(AVAL(event="2") / ADJUSTOBS= (IMPLEVEL1="IMP1") shift=2) ; run; /*This imputation does the same thing, I think? but produces a WARNING: WARNING: IMPLEVEL2=IMP1a is not a valid classification level in the ADJUSTOBS= option in the MNAR statement. */ proc mi data=dsin out=filled2 nimpute=10000; class AVAL TRT IMPLEVEL2; var TRT AVAL; monotone logistic(AVAL = TRT); mnar adjust(AVAL(event="2") / ADJUSTOBS= (IMPLEVEL2="IMP0") shift=1) adjust(AVAL(event="2") / ADJUSTOBS= (IMPLEVEL2="IMP1a") shift=2) adjust(AVAL(event="2") / ADJUSTOBS= (IMPLEVEL2="IMP1b") shift=2) /*This is a pointless because there is no missing data with IMPLEVEL2="IMP1b", but leave it here anyway for completeness*/ ; run; proc sort data=filled1; by TRT; run; proc means data=filled1; by TRT; var AVAL; run; proc sort data=filled2; by TRT; run; proc means data=filled2; by TRT; var AVAL; run; /*the imputed data appears identical (on average) so why the WARNING?*/
Suggest running:
proc freq data=dsin; tables aval*implevel2; run;
and examine how many combinations of aval=2 and implevel2='Imp1a'.
Hard to impute the result when that combination never occurs in the data.
@benji3 wrote:
Hi all,
I'd like some help understanding a WARNING I'm receiving from proc MI when shifting imputations according to some classification variable (i.e. different shifts by different levels of the class variable).
My understanding of the code below is that I have called proc MI twice and using the same imputation model (one fit using all the data which depends only on the TRT variable) I have adjusted the MAR imputations by some shift (on the log-odds scale in this case because the model is and ordered logistic model.
I do not understand why a WARNING would be given, apparently because the observations selected for adjustment all have a missing outcome value. I think there is a single imputation model. Why does it matter if the adjustments to a selection of observations happen to be unique to variables with a missing outcome? And the imputation appears to still be correctly performed despite the WARNING?
Can anyone shed light on this?
Thank you!
/*create some data to illustrate the WARNING*/ data dsin; call streaminit(1); do USUBJID=1 to 200; if rand("UNIFORM") gt 0.2 then AVAL = rand("BINOMIAL", 0.5, 2); else AVAL=.; TRT = mod(USUBJID, 2); select; when (TRT=0) do; IMPLEVEL1="IMP0"; IMPLEVEL2="IMP0 "; end; when (AVAL=. and TRT=1) do; IMPLEVEL1="IMP1"; IMPLEVEL2="IMP1a"; end; when (AVAL ne . and TRT=1) do; IMPLEVEL1="IMP1"; IMPLEVEL2="IMP1b"; end; end; output; end; run; /*This imputation shifts log odds of event=2 by 1 in TRT=0 and by 2 in TRT=1 arm compared to an MAR imputation?*/ proc mi data=dsin out=filled1 nimpute=10000; class AVAL TRT IMPLEVEL1; var TRT AVAL; monotone logistic(AVAL = TRT); mnar adjust(AVAL(event="2") / ADJUSTOBS= (IMPLEVEL1="IMP0") shift=1) adjust(AVAL(event="2") / ADJUSTOBS= (IMPLEVEL1="IMP1") shift=2) ; run; /*This imputation does the same thing, I think? but produces a WARNING: WARNING: IMPLEVEL2=IMP1a is not a valid classification level in the ADJUSTOBS= option in the MNAR statement. */ proc mi data=dsin out=filled2 nimpute=10000; class AVAL TRT IMPLEVEL2; var TRT AVAL; monotone logistic(AVAL = TRT); mnar adjust(AVAL(event="2") / ADJUSTOBS= (IMPLEVEL2="IMP0") shift=1) adjust(AVAL(event="2") / ADJUSTOBS= (IMPLEVEL2="IMP1a") shift=2) adjust(AVAL(event="2") / ADJUSTOBS= (IMPLEVEL2="IMP1b") shift=2) /*This is a pointless because there is no missing data with IMPLEVEL2="IMP1b", but leave it here anyway for completeness*/ ; run; proc sort data=filled1; by TRT; run; proc means data=filled1; by TRT; var AVAL; run; proc sort data=filled2; by TRT; run; proc means data=filled2; by TRT; var AVAL; run; /*the imputed data appears identical (on average) so why the WARNING?*/
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.