Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Analytics
- /
- Stat Procs
- /
- GENMOD CLASS REF=

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 09-23-2009 08:54 AM
(10392 views)

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

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

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

2 REPLIES 2

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thanks, Dale,

Indeed, I was using SAS 9.1...

Laura

Indeed, I was using SAS 9.1...

Laura

**Don't miss out on SAS Innovate - Register now for the FREE Livestream!**

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

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.