BookmarkSubscribeRSS Feed
SASnewbiee
Fluorite | Level 6

Hello,

 

I am trying to understand how we can test a level that is also a reference group??

 

I'm focusing on race here for hypothesis testing. Race is categorized as:

1 White

2 Other

3 Black

4 Hispanic

 

Code I used:

 

Proc PHREG data=x;

class race (ref=first);

model time*status(0)= age race gender;

 

contrast 'white+other Vs. Black+hispanic' race (1 1 -1 -1);

run;

 

Will this contrast statement test the hypothesis of category what/other vs black/hispanic? or do I need to remove the class statement to do so, since the class statement would make the ref category to 0..

 

So confused.

 

 

2 REPLIES 2
ChrisNZ
Tourmaline | Level 20

Moved to STAT forum in the hope you'll get an answer there.

SteveDenham
Jade | Level 19

Rather than writing a contrast statement (which requires knowing coefficients for all the effects in a model, even though most would be zero in your case) try using an lsmestiimate statement which compares the average of white and other to the average of black and hispanic;

 

lsmestimate race 'white+other Vs. Black+hispanic' 1 1 -1 -1/divisor=2;

 

Reference levels don't enter into things this way.  Instead least squares means for each level are constructed and then compared using the coefficients.  You can check this by also adding

 

lsmeans race;

 

and hand computing the difference.  It should match the lsmestimate value.

 

SteveDenham

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 1145 views
  • 1 like
  • 3 in conversation