BookmarkSubscribeRSS Feed
lindsaypaige
Calcite | Level 5

Hi all, 

 

I am using SAS Studio. I'm trying to compute the odds ratios and confidence intervals for all of the levels within a variable. For example, I am looking at how maltreatment exposure predicts chronic pain. Maltreatment exposure has four levels: 1, 2, 3, and 4, to indicate frequency of occurrence. I want to see what the odds are for developing chronic pain if someone has a maltreatment frequency of 1, a maltreatment frequency of 2, and so on. I have tried both PROC LOGISTIC and PROC GLIMMIX, but I only get one odds ratio, instead of an odds ratio for each level of the variable. 

 

My predictors include age (8-19 years), gender (0 or 1), placement type (1 or 1), and maltreatment exposure (1,2,3,and 4). My outcome is chronic pain (0 or 1). I would like to look at the odds of chronic pain for all of the levels of all of my variables. 

 

TITLE1 "Single-Level Logistic Model Predicting Chronic Pain";
PROC GLIMMIX DATA=work.pain NOCLPRINT NAMELEN=100 METHOD=QUAD (QPOINTS=15) GRADIENT;
CLASS PID; * Descending makes us predict the 1 instead of the default-predicted 0;
MODEL chronicpain (DESCENDING) = age_c Gender GroupHome RndChron_c / SOLUTION LINK=LOGIT DIST=BINARY DDFM=Satterthwaite ODDSRATIO;
ESTIMATE "Intercept" intercept 1 / ILINK; * ILINK is inverse link (to un-logit);
ESTIMATE "Chronic Pain if Age=9" intercept 1 age_c 1 / ILINK;
ESTIMATE "Chronic Pain if Age=10" intercept 1 age_c 2 / ILINK;
RUN;

 

Thanks for your help!

 

Lindsay 

1 REPLY 1
PGStats
Opal | Level 21

Your code doesn't include any reference to maltreatment and your model doesn't include any reference to PID...

 

Assuming that all your independent variables are classes, you could start with:

 

TITLE1 "Single-Level Logistic Model Predicting Chronic Pain";

PROC GLIMMIX DATA=work.pain NOCLPRINT NAMELEN=100 METHOD=QUAD (QPOINTS=15) GRADIENT;
CLASS age_c Gender GroupHome RndChron_c; 
MODEL chronicPain (event="1") = age_c Gender GroupHome RndChron_c / SOLUTION LINK=LOGIT DIST=BINARY DDFM=Satterthwaite;
lsmeans age_c / oddsratio;
lsmeans gender / oddsratio;
lsmeans groupHome / oddsratio;
lsmeans RndChron_c / oddsratio;
RUN;

(untested)

 

PG

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 1 reply
  • 1178 views
  • 0 likes
  • 2 in conversation