BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
tka726
Obsidian | Level 7

Hello!

I'm trying to write some contrast statements in proc logistic.  The dependent variable is event (0,1) and the independent variable is quintile, which has 5 categories (0, 1, 2, 3, 4). I want the value of 2 to be the reference, but also want to compare other quintiles.  

 

PROC LOGISTIC DATA=origs descending;
CLASS  quint(ref="2")/param=ref;
model event= quint;

contrast '0vs2' quint  1  0  0  0  -1 /estimate=both;
contrast '1vs2' quint  0  1  0  0  -1 /estimate=both;
contrast '3vs2' quint  0  0  1  0  -1 /estimate=both;
contrast '4vs2' quint  0  0  0  1  -1 /estimate=both;

 

I found that the contrast statements above yield the same results as the model output (with 2 as the reference), but I can not figure out how to write contrast statements to compare, say quintile 3 vs 4. Any thoughts?

 

1 ACCEPTED SOLUTION

Accepted Solutions
StatDave
SAS Super FREQ

It's always best to avoid the CONTRAST and ESTIMATE statements when other statements that don't require specifying contrast coefficients can do what you want. In this case, you probably just need a single LSMEANS statement. Note the change of PARAM= to GLM.

 

PROC LOGISTIC DATA=origs descending;
CLASS  quint(ref="2")/param=glm;
model event= quint;

lsmeans quint / diff oddsratio;

run;

View solution in original post

2 REPLIES 2
StatDave
SAS Super FREQ

It's always best to avoid the CONTRAST and ESTIMATE statements when other statements that don't require specifying contrast coefficients can do what you want. In this case, you probably just need a single LSMEANS statement. Note the change of PARAM= to GLM.

 

PROC LOGISTIC DATA=origs descending;
CLASS  quint(ref="2")/param=glm;
model event= quint;

lsmeans quint / diff oddsratio;

run;

tka726
Obsidian | Level 7

This is perfect, thank you!

SAS Innovate 2025: Call for Content

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 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 1456 views
  • 1 like
  • 2 in conversation