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;
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
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;
Can you post the LOG and the accompanying ERROR message?
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
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
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 16. 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.