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?
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;
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;
This is perfect, thank you!
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!
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.