BookmarkSubscribeRSS Feed
MGhab
Obsidian | Level 7

I am attempting to conduct multiple imputation for my modified poisson regression analysis. Everything seems to work until the proc mianalyze step. At the proc mianalyze step, I receive an error that the first categorical variable listed (in this case, ethnorac1) is not in the "parms=" dataset. The error says: "ERROR: The model effect ethnorac1 is not in the PARMS= data set."

 

As you can see in the proc genmod command, I also try to generate a covb output (as I've seen recommended elsewhere), but for some reason, I also receive a warning that "output covb was not created."


I have only successfully conducted multiple imputation with linear regression in the past so I began by using that code as a template. I'm not sure which commands or details I'm missing that need to be modified for my current analysis. Code is below. Thank you!

 

/*Step 1: Imputation Phase*/
proc mi data=tpc2019irn seed=573382369 nimpute=20 out=irnfcs ;
title3 'Imputing Phase irn ppct';
  class ethnorac a13status d3_reasons a14 pp_immigrant provreg a8_7cat b5gp b2 poverty_2cat e1_3cat f1_2cat i2recode d8lgbtcom ;
var  a1 ethnorac a13status d3_reasons a14 pp_immigrant provreg a8_7cat  b5gp b2 poverty_2cat e1_3cat f1_2cat i2recode tpcweights Indi_a d1_length d8lgbtcom; 
fcs logistic (provreg = Indi_a d3_reasons /details);
fcs logistic (a8_7cat = Indi_a poverty_2cat d3_reasons ethnorac/ details );
fcs logistic (b5gp = b2 i2recode Indi_a poverty_2cat / details );
fcs discrim (b2 = b5gp Indi_a /classeffects=include);
fcs discrim (poverty_2cat = a1 a13status b5gp b2 Indi_a /classeffects=include);
fcs logistic (e1_3cat = a1 a14 ethnorac a13status d3_reasons a8_7cat f1_2cat/details);
fcs discrim (i2recode = a1 b2 b5gp ethnorac d3_reasons a8_7cat f1_2cat/classeffects=include);
fcs regression (indi_a = a1 b2 b5gp ethnorac a8_7cat poverty_2cat provreg d1_length);
fcs regression (d1_length = a1 a8_7cat poverty_2cat a13status a14);
fcs logistic (d8lgbtcom = a1 a14 b5gp b2 ethnorac a13status d3_reasons /details);

Proc GenMod data=irnfcs  ;
title3 'MI. Mod Pois Regress. Healthcare provider w/o moderators';
Class id f1_2cat (ref='0') ethnorac (ref='0') b5gp (ref='1') b2 (ref='1') provreg (ref='1') a13status (ref='0') d3_reasons (ref='0') a8_7cat (ref='2') d8lgbtcom (ref='1') poverty_2cat (ref='0') e1_3cat (ref='1') /param=ref ref=first;
Model f1_2cat = a1 ethnorac e1_3cat b5gp b2 provreg d1_length a13status d3_reasons a8_7cat  d1_length d8lgbtcom poverty_2cat
/ Dist=poisson Link=log;
weight tpcweights;
by _imputation_ ;
Repeated subject=id  / printmle type=Ind;
ods output parameterestimates = regparms
ParmInfo = gmpinfo
CovB = gmcovb;
Estimate 'ethno' ethnorac 1 0 /exp;
Estimate 'gender' b5gp 1 -1/exp;
Estimate 'sab' b2 1 0/exp;
Estimate 'provreg' provreg 1 -1/exp;
Estimate 'status' a13status 1 -1/exp;
Estimate 'reasons' d3_reasons 1 0/exp;
Estimate 'regions of origin' a8_7cat 1 -1/exp;
Estimate 'length' d1_length 1 /exp;
Estimate 'age' a1 1 /exp;
Estimate 'd8lgbtcom' d8lgbtcom 1 /exp;
run;

proc print data=regparms; run;

proc sort data=regparms;
by _imputation_; run;

data regparms2;
set regparms;
parameter=compress(parameter);
proc print data=regparms2;
by _imputation_; run;

proc mianalyze parms=regparms2 ;
modeleffects intercept a1 ethnorac1 e1_3cat2 e1_3cat3
b5gp2 b5gp3 b22  provreg2 provreg3 provreg4 d1_length a13status1 a13status2 d3_reasons1 poverty_2cat1 a8_7cat3 a8_7cat4 a8_7cat5 a8_7cat6 a8_7cat7  d8lgbtcom2;
run;

 

9 REPLIES 9
sbxkoenk
SAS Super FREQ

Hello,

 

I think, for GENMOD, you need to take care of a few additional things.

 

Please check :

SAS/STAT® 15.1
User’s Guide The MIANALYZE Procedure

https://support.sas.com/documentation/onlinedoc/stat/151/mianalyze.pdf

 

and search for the key-word << GENMOD >>.

 

Let me know if you cannot sort it out and then I will try to do it for you!

 

Thanks,

Koen

MGhab
Obsidian | Level 7
Thanks, Koen! I tried to follow this manual yesterday, but continued to get errors. it's possible I don't understand the instructions. For example, adding "classvar=classval)" led to an error that the variable classval does not exist. The modeleffects list with "c3(c2 c1)" also confused me, as I wasn't sure how (or why) to apply this structure to my own code.

I've tried to update my code again to follow these steps (abbreviated version posted below), but still receive a warning that the item covb could not be created. Any help you can provide would be appreciated!

Proc GenMod data=irnfcs ;
title3 'MI. Mod Pois Regress. Healthcare provider w/o moderators';
Class id f1_2cat (ref='0') ethnorac (ref='0') b5gp (ref='1') b2 (ref='1') provreg (ref='1')
a13status (ref='0') d3_reasons (ref='0') a8_7cat (ref='2') d8lgbtcom (ref='1')
poverty_2cat (ref='0') e1_3cat (ref='1') /param=ref ref=first;
Model f1_2cat = a1 ethnorac e1_3cat b5gp b2 provreg d1_length a13status d3_reasons a8_7cat
d1_length d8lgbtcom poverty_2cat
/ Dist=poisson Link=log;
weight tpcweights;
by _imputation_ ;
Repeated subject=id /printmle type=Ind;
ods output parameterestimates = regparms
ParmInfo = irnparminfo
CovB = irncovb;
run; ods select all;

proc print data=regparms; run;

proc sort data=regparms;
by _imputation_; run;
data regparms2;
set regparms;
parameter=compress(parameter);
proc print data=regparms2;
by _imputation_; run;

proc mianalyze parms=regparms2 covb=irncovb parminfo=irnparminfo;
modeleffects intercept a1 ethnorac1 e1_3cat2 e1_3cat3
b5gp2 b5gp3 b22 provreg2 provreg3 provreg4 d1_length a13status1 a13status2 d3_reasons1
poverty_2cat1 a8_7cat3 a8_7cat4 a8_7cat5 a8_7cat6 a8_7cat7 d8lgbtcom2;
run;
SAS_Rob
SAS Employee

Technically you do not need to have the COVB= or PARMINFO= data sets in MIANALYZE unless you have a TEST statement or use the MULT option (neither of which you can use with a CLASS statement).  So I would remove them first of all.  Second, you need to request the correct estimates--those that come from the REPEATED statement by outputting the GEEEmpPest table.  Finally it is not necessary to do any post-processing to the parameter estimates table to read it into MIANALYZE.  Note also that if you do not have a variable in the MODEL or as the SUBJECT= effect on the REPEATED statement, then you should remove it from the CLASS statement.

 

Proc GenMod data=irnfcs ;
title3 'MI. Mod Pois Regress. Healthcare provider w/o moderators';
Class id ethnorac (ref='0') b5gp (ref='1')  provreg (ref='1') a13status (ref='0') d3_reasons (ref='0') a8_7cat (ref='2') d8lgbtcom (ref='1') poverty_2cat (ref='0') e1_3cat (ref='1') /param=ref ref=first;
Model f1_2cat = a1 ethnorac e1_3cat b5gp b2 provreg d1_length a13status d3_reasons a8_7cat
d8lgbtcom poverty_2cat/ Dist=poisson Link=log;
weight tpcweights;
by _imputation_ ;
Repeated subject=id /printmle type=Ind;
ods output GEEEmpPest= regparms;
run; 

proc mianalyze parms(classvar=level)=regparms;

class a1 ethnorac e1_3cat b5gp b2 provreg a13status d3_reasons a8_7cat d8lgbtcom poverty_2cat;

modeleffects intercept a1 ethnorac e1_3cat b5gp b2 provreg d1_length a13status d3_reasons a8_7cat
d8lgbtcom poverty_2cat;

run;

 

MGhab
Obsidian | Level 7
Thanks, Rob. I copied and pasted your solution and it's causing my program to crash each time I run it (before completing the mianalyze stage). Do you know why that might be?
SAS_Rob
SAS Employee

Can you post the LOG and the accompanying ERROR message?

MGhab
Obsidian | Level 7
The code successfully runs until it begins proc mianalyze. At this point, it freezes - so there is no information about the issue in the log and there is no error notice. My program has never frozen before and whatever is now happening at proc mianalyze has caused the program to freeze multiple times, so I'm not sure what the issue could be.
sbxkoenk
SAS Super FREQ

Hello,

 

Are you sure SAS does not keep freezing because of this :

Errors that cause SAS to "freeze"... and what to do about them
By Rick Wicklin on The DO Loop August 19, 2013

https://blogs.sas.com/content/iml/2013/08/19/errors-that-cause-sas-to-freeze.html

 

Cheers,

Koen

sbxkoenk
SAS Super FREQ

Hello @MGhab ,

 

Any feedback?

 

Please know that you can also contact SAS Technical Support in your country with problems like this one.

If needed, you can speak to them and possibly do screen sharing in a meeting. That may make things easier.

 

Good luck,

Koen

MGhab
Obsidian | Level 7
Hi Koen,
I discovered that the error was happening because some code was lost in the copy and paste process. All is resolved now, thanks to the code solutions provided here. Thank you!

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 9 replies
  • 1295 views
  • 4 likes
  • 3 in conversation