Programming the statistical procedures from SAS

Proc Logistic with PROC MI and PROC MIANALYZE: Class Variable Problem

Reply
Occasional Contributor
Posts: 12

Proc Logistic with PROC MI and PROC MIANALYZE: Class Variable Problem

Hello SAS communities: I am trying to carry out a multiple imputation procedure using PROC MI; PROC MIANALYZE as well as the experimental FCS option in SAS 9.3.  The missings are random NOT monotonic. I have a dataset (survey data) with approximate N=4,800 observations. The dept variable DTHPEN is support for capital punishment (0=No; 1=Yes), I am trying to predict support for death penalty.

Independent vars are GENDER (CLASS Variable coded 0=Male; 1=Female); church attendance (ordinal variable 0-7); and number of children (numerical, actual number of
children). Weight variable is VAR5416; I plan to add more variables into the equation but am trying to use PROC MI and MIANALYZE. I want to work with a smaller number of variables before moving on. I have pasted the code I am using below. Everything seems to work fine for the PROC MI and PROC logistic runs (Step 1 and Step 2) but the PROC MIANALYZE procedure gives me the following warning in the SAS LOG:

"ERROR: Variable GENDER is not in the PARMS= data set.

I assume I am having some problem with gender as a CLASS variable? Any assistance is greatly appreciated.

Thanks!

Gabriel

/*STEP 1: Enter data for imputation*/

procmi data=WORK.CAPWHT nimpute=25out=helpmi25fcs;

class DTHPEN GENDER;

FCS logistic(DTHPEN = ATTNDC CHLDRN) logistic (GENDER);

var ATTNDC CHLDRN GENDER DTHPEN; run;

/*STEP 2: Code for the logistic regression*/

proclogistic data = helpmi25fcs descending;

class DTHPEN GENDER;

model DTHPEN= ATTNDC CHLDRN GENDER / covb expb;

by _Imputation_;

weight VAR5416;

odsoutput ParameterEstimates=helpmipefcs covb=helpmicovbfcs;RUN;

/*step 3 MIANALYZE procedure*/

title"proc Logistic imputations for relig variables";

title2"Whites only 25 Iterations";

procmianalyze parms=helpmipefcs covb(effectvar=stacking)=helpmicovbfcs;

class GENDER;

modeleffects intercept ATTNDC CHLDRN GENDER;

run;quit;

Respected Advisor
Posts: 2,655

Re: Proc Logistic with PROC MI and PROC MIANALYZE: Class Variable Problem

Don't know if this will solve the problem or not but I think you may need to rewrite your proc mianalyze statement.  It looks like you need a classvar= option added to the parms= part of the statement.  Check dataset helpmipefcs to see how the variable is coded.  If it is explicit, then the default FULL is what you need, if it is Level1, Level2, etc., you will need classvar=level.  See the documentation for Input Data Sets under the MIANALYZE Procedure for a better description than I am giving.

Steve Denham

Occasional Contributor
Posts: 12

Re: Proc Logistic with PROC MI and PROC MIANALYZE: Class Variable Problem

Thanks so much Steve! I typically code dummy variables numerically using the highest as the omitted (e.g. 0="African American"; 1="Hispanic"; 2="Non-Hispanic White" as reference). I will add the statement your provided above as soon as I get back to the office. Thanks Again! Gabriel

New Contributor
Posts: 2

Re: Proc Logistic with PROC MI and PROC MIANALYZE: Class Variable Problem

hi SAS communities: I have a similar questions. Everything seems to work fine for the PROC MI and PROC logistic runs (Step 1 and Step 2) but the PROC MIANALYZE procedure gives me the following warning in the SAS LOG:

 "ERROR: Variable sex is not in the PARMS= data set."

Any assistance is greatly appreciated.Thanks!

/*STEP 1: Enter data for imputation*/

proc mi data= yes_1   nimpute=20 out=t2 seed=776712;

class a3-a6; 

fcs  discrim ( a3  =  a1 age_g a4/ classeffects=include ) ;

fcs  discrim ( a4  =  a1 age_g / classeffects=include ) ;

fcs  discrim ( a5  =  a1 age_g a4/ classeffects=include ) ;

fcs  discrim ( a6  =  a1 age_g a4/ classeffects=include ) ;

var a1 age_g a3-a6 ;

run;

/*STEP 2: Code for the REG*/

proc reg data=t8 outest=great covout ;
model hmsa_g= sex age_g edu marr li re a7_g a8 ha_g sa_g ma_g d2_21 fa_g qa_g/ covb;
by _Imputation_;
ods output ParameterEstimates=gmparms parminfo=gmpinfo CovB=gmcovb;
run;

/*step 3 MIANALYZE procedure*/

proc mianalyze parms(classvar=full)=gmparms covb(effectvar=ROWCOL)=gmcovb ;
class sex d2_21 age_g edu marr li re a7_g a8 ha_g sa_g ma_g fa_g qa_g;
modeleffects intercept sex d2_21 age_g edu marr li re a7_g a8 ha_g sa_g ma_g fa_g qa_g;
run;

 

 

 

 
Respected Advisor
Posts: 2,655

Re: Proc Logistic with PROC MI and PROC MIANALYZE: Class Variable Problem

This may be trivial or just a typo, but the output dataset from PROC MI is called t2, and the input to REG is called t8.  Check the contents of the input file to REG.

 

Steve Denham

New Contributor
Posts: 2

Re: Proc Logistic with PROC MI and PROC MIANALYZE: Class Variable Problem

Thank you very much Steve!:t8 is t2  export and mean some variables{ex: hmsa_g=(a1+a2+a3+a6)/4}.Other questions how can i do for setting limit in STEP 1(ex. if a4=0 then a5=0;if a4>=1 then a5>=1; A4 is comorbidity and a5 is number of comorbiditys. 

Thanks.

Respected Advisor
Posts: 2,655

Re: Proc Logistic with PROC MI and PROC MIANALYZE: Class Variable Problem

To guarantee the restrictions you are placing on the variables, you will have to post-process the the output dataset from PROC MI.  Using a DATA step, you should be able to do this.  You may need to restrict the input data so that these boundary conditions are not part of the imputation process, as well.

 

Steve Denham

Ask a Question
Discussion stats
  • 6 replies
  • 1113 views
  • 0 likes
  • 3 in conversation