BookmarkSubscribeRSS Feed
ROLuke91
Obsidian | Level 7

Hi all,

 

I am experiencing difficulty in performing Multiple Imputation with PROC MI and PROC MIANALYZE. I'm looking to impute the missing data in a continuous variable from a model containing a mix of continuous and categorical variables

 

My code:

proc mi data=DATA seed=123456789 out=miOut minimum=0 maximum=120 nimpute=50 noprint;
FCS;
var X1 X2 X3 X4 X5 X6 X7 X8 X9;
run;

proc sort data=miOut;
by _IMPUTATION_;
run;

proc genmod data = miOutNoMiss;
by _imputation_;
class X2 X3 X4 X5 X6 X7; 
model X9 = X1 X2 X3 X4 X5 X6 X7 X8/covb dist = normal link = identity;
ods output ParameterEstimates = gmparms
           ParmInfo = gmpinfo
		   CovB = gmcovb;
run;
quit;

proc mianalyze parms(classvar=level)=gmparms;
class X2 X3 X4 X5 X6 X7 ; 
modeleffects Intercept X1 X2 X3 X4 X5 X6 X7 X8 X9;
run;

 

My variable of interest is X9, which is continuous. X1-X8 are my predictor variables, with X1 and X8 as continuous variables, while X2-X7 are binomial/multinomial categorical variables. My goal is to multiply impute X9 from the model of X1-X8, and the above code is correct to my understanding of how to do this. Method FCS is chosen because my missing pattern is not monotonic.

 

My problem is an error I experience an error when I run proc MIANALYZE:

 

"ERROR: The model effect CAPS1 is not in the PARMS= data set."

 

I'm unsure where this is coming from and am at a standstill for how or what to troubleshoot. Could anybody please advise?

 

Thanks and Best Regards,

Luke

 

 

 

4 REPLIES 4
SAS_Rob
SAS Employee
Try specifying the CLASSVAR=LEVEL as explained in this usage note.
http://support.sas.com/kb/32/799.html
ROLuke91
Obsidian | Level 7

Thank you very much for your response.

 

However, my code in my original post - which resulted in the error -  did contain CLASSVAR=LEVEL. See below:

 

proc mianalyze parms(classvar=level)=gmparms;
class X2 X3 X4 X5 X6 X7 ; 
modeleffects Intercept X1 X2 X3 X4 X5 X6 X7 X8 X9;
run;

When I cycle through the other "CLASSVAR = " options, such as FULL and CLASSVAL (even though they're not indicated for PROC GENMOD results), I receive the same error, but with different variables that are "not in the parms dataset."

 

Is there anything that I should troubleshoot with respect to the data itself? I know that there is missing in every single variable. However, it's a very low percentage for each variable excepting Y (my imputation variable of interest). And I was under the impression that the FCS option handles non-monotonic missing.

 

Best,

Luke 

SAS_Rob
SAS Employee

Sorry for the confusion.  If you can it might be easier to help diagnose if you include the actual variables you are using in the code and LOG output. 

 

Is Caps1 (the variable listed in the ERROR message) the response variable?  If so, then it would not be in the PARMS data set and should not appear in the MODELEFFECTS statement.

ROLuke91
Obsidian | Level 7

Yes, that is my Y variable and imputation variable of interest. Thank you for noting that, and I've made the appropriate adjustments in MIANALYZE. Updated code here:

 

proc mi data=dir.ADTrialDataCleanedNoMiss seed=123456789 out=miOutNoMiss minimum=0 maximum=120 nimpute=50 noprint;

FCS;

var X1 X2 X3 X4 X5 X6 X7 X8 Y;

run;

 

proc sort data=miOutNoMiss;

by _IMPUTATION_;

run;

 

proc genmod data = miOutNoMiss;

by _imputation_;

class X2 X3 X4 X5 X6 X7 (ref = '0');

model Y = X1 X2 X3 X4 X5 X6 X7 X8/covb dist = normal link = identity;

ods output ParameterEstimates = gmparms

           ParmInfo = gmpinfo

                  CovB = gmcovb;

run;

quit;

 

proc sort data = gmparms;

by _Imputation_;

run;

 

proc mianalyze parms(classvar = level)=gmparms;

class X2 X3 X4 X5 X6 X7;

modeleffects Intercept X1 X2 X3 X4 X5 X6 X7 X8;

run;

 

 

 

However, now I'm getting a new, replacement error: 

 

"ERROR: Within-imputation Estimate missing for effect X2 in _Imputation_= 2 in the input
PARMS= data set."

 

Below is my log

 

109  proc mi data=data seed=123456789 out=miOutNoMiss minimum=0

109! maximum=120 nimpute=50 noprint;

110  FCS;

111  var X1 X2 X3 X4 X5 X6 X7 X8 Y;

112  run;

 

NOTE: The data set WORK.MIOUTNOMISS has 6150 observations and 1728 variables.

NOTE: PROCEDURE MI used (Total process time):

      real time           15.34 seconds

      cpu time            1.85 seconds

 

 

113

114  proc sort data=miOutNoMiss;

115  by _IMPUTATION_;

116  run;

 

NOTE: There were 6150 observations read from the data set WORK.MIOUTNOMISS.

NOTE: The data set WORK.MIOUTNOMISS has 6150 observations and 1728 variables.

NOTE: PROCEDURE SORT used (Total process time):

      real time           0.98 seconds

      cpu time            0.37 seconds

 

 

117

118  proc genmod data = miOutNoMiss;

119  by _imputation_;

120  class X2 X3 X4 X5 X6 X7 (ref = '0');

121  model Y = X1 X2 X3 X4 X5 X6 X7 X8/covb dist

121! = normal link = identity;

122  ods output ParameterEstimates = gmparms

123             ParmInfo = gmpinfo

124             CovB = gmcovb;

125  run;

 

NOTE: Algorithm converged.

NOTE: The scale parameter was estimated by maximum likelihood.

NOTE: The above message was for the following BY group:

      Imputation Number=1

        ....

NOTE: Algorithm converged.

NOTE: The scale parameter was estimated by maximum likelihood.

NOTE: The above message was for the following BY group:

      Imputation Number=50

NOTE: The data set WORK.GMCOVB has 1100 observations and 32 variables.

NOTE: The data set WORK.GMPINFO has 1800 observations and 9 variables.

NOTE: The data set WORK.GMPARMS has 1850 observations and 10 variables.

NOTE: PROCEDURE GENMOD used (Total process time):

      real time           34.36 seconds

      cpu time            2.52 seconds

 

 

126  quit;

127

128  proc sort data = gmparms;

129  by _Imputation_;

130  run;

 

NOTE: There were 1850 observations read from the data set WORK.GMPARMS.

NOTE: The data set WORK.GMPARMS has 1850 observations and 10 variables.

NOTE: PROCEDURE SORT used (Total process time):

      real time           0.10 seconds

      cpu time            0.00 seconds

 

 

131

132  proc mianalyze parms(classvar = level)=gmparms;

133  class X2 X3 X4 X5 X6 X7;

134  modeleffects Intercept X1 X2 X3 X4 X5 X6 X7 X8;

135  run;

 

ERROR: Within-imputation Estimate missing for effect X2 in _Imputation_= 2 in the input

       PARMS= data set.

NOTE: The SAS System stopped processing this step because of errors.

NOTE: PROCEDURE MIANALYZE used (Total process time):

      real time           0.06 seconds

      cpu time           

 

Thanks,

Luke

 

 

SAS Innovate 2025: Call for Content

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!

Submit your idea!

What is ANOVA?

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.

Discussion stats
  • 4 replies
  • 2531 views
  • 4 likes
  • 2 in conversation