BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
I have problems with v-option for the CLASS statement of GENMOD:

proc genmod data = one ;
class Var1 ( ref = "A" )
Var2 ( ref = "B" )
/ param = ref
;
model Y = Var1 Var2 ;
run ;
quit ;

The log stated that I had the wrong type for Var2.

f I switch VAR1 and Var2 in Class statement, then the log states that I have the wrong type for Var1:

class Var2 ( ref = "B" )
Var1 ( ref = "A" )
/ param = ref
;


If I use just one covariate (Var1 or Var2), then everything is fine.

Any ideas what's happening?

Thanks,
Laura
1 ACCEPTED SOLUTION

Accepted Solutions
Dale
Pyrite | Level 9
Laura,

You must be using SAS 9.1 rather than SAS 9.2. I replicated your error for my 9.1 SAS install. It is a bug in version 9.1. The bug is fixed in SAS version 9.2.

I looked for a hotfix for 9.1 but could not find anything having to do with the CLASS statement of PROC GENMOD. Can you update to SAS version 9.2? If not, then you will have to mimic the results that would be returned for the reference specification that you want by using ESTIMATE statements.

Pursuing the use of ESTIMATE statements, suppose that Var2 has m=4 levels, "A" through "D", and you want to use "B", the second level of Var2, as the reference level. The following set of ESTIMATE statements would return the parameters that would have been estimated if you could use "B" for the reference for Var2. We are able to specify that the reference level for var1 is 'A'.

proc genmod data=one;
  class var1(ref="A") var2 / param=ref;
  model y = var1 var2;
  estimate "Intercept"
    intercept 1
    var2      0 1 0;
  estimate "Var1='B'"
    var1      1 0;
  estimate "Var1='C'"
    var1      0 1;
  estimate "Var2='A'"
    var2      1 -1 0;
  estimate "Var2='C'"
    var2      0 -1 1;
  estimate "Var2="D"'
    var2      0 -1 0;
  run;

You will observe that the intercept under the model with the second level of Var2 as reference is the estimated intercept plus the value of the parameter which you wish to be the reference value. The effect estimates for Var2 are the observed parameter estimates minus the value of the parameter that is now fixed to be the reference level. This might not seem to be the case for the level which was the reference level actually employed by the GENMOD procedure since we don't see any contrast, just a subtraction of the value of the parameter which was estimated for Var2='B'. However, since the last level had a value of 0 and the value of the parameter for the new reference level subtracted from zero can be expressed simply by taking the negative of the intended reference level value, the specification for what was employed as the reference level is consistent with all other levels of Var2. The parameter estimates for Var1 are not affected by the reparameterization.

HTH,

Dale

View solution in original post

2 REPLIES 2
Dale
Pyrite | Level 9
Laura,

You must be using SAS 9.1 rather than SAS 9.2. I replicated your error for my 9.1 SAS install. It is a bug in version 9.1. The bug is fixed in SAS version 9.2.

I looked for a hotfix for 9.1 but could not find anything having to do with the CLASS statement of PROC GENMOD. Can you update to SAS version 9.2? If not, then you will have to mimic the results that would be returned for the reference specification that you want by using ESTIMATE statements.

Pursuing the use of ESTIMATE statements, suppose that Var2 has m=4 levels, "A" through "D", and you want to use "B", the second level of Var2, as the reference level. The following set of ESTIMATE statements would return the parameters that would have been estimated if you could use "B" for the reference for Var2. We are able to specify that the reference level for var1 is 'A'.

proc genmod data=one;
  class var1(ref="A") var2 / param=ref;
  model y = var1 var2;
  estimate "Intercept"
    intercept 1
    var2      0 1 0;
  estimate "Var1='B'"
    var1      1 0;
  estimate "Var1='C'"
    var1      0 1;
  estimate "Var2='A'"
    var2      1 -1 0;
  estimate "Var2='C'"
    var2      0 -1 1;
  estimate "Var2="D"'
    var2      0 -1 0;
  run;

You will observe that the intercept under the model with the second level of Var2 as reference is the estimated intercept plus the value of the parameter which you wish to be the reference value. The effect estimates for Var2 are the observed parameter estimates minus the value of the parameter that is now fixed to be the reference level. This might not seem to be the case for the level which was the reference level actually employed by the GENMOD procedure since we don't see any contrast, just a subtraction of the value of the parameter which was estimated for Var2='B'. However, since the last level had a value of 0 and the value of the parameter for the new reference level subtracted from zero can be expressed simply by taking the negative of the intended reference level value, the specification for what was employed as the reference level is consistent with all other levels of Var2. The parameter estimates for Var1 are not affected by the reparameterization.

HTH,

Dale
deleted_user
Not applicable
Thanks, Dale,

Indeed, I was using SAS 9.1...

Laura

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

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
  • 2 replies
  • 11300 views
  • 0 likes
  • 2 in conversation