BookmarkSubscribeRSS Feed
mj8000
Calcite | Level 5

Hello,

 

I have a question regarding the output format in a binary logistic regression. By default, SAS is generating false vs. true format for my binary logistic regression. Is there a way to get this format to be true vs. false instead?

 

 

5 REPLIES 5
Reeza
Super User

Yes, in the MODEL statement you can specify the definition of an event. 

 

model myVariable (event='False') = .... ;

@mj8000 wrote:

Hello,

 

I have a question regarding the output format in a binary logistic regression. By default, SAS is generating false vs. true format for my binary logistic regression. Is there a way to get this format to be true vs. false instead?

 

 


 

mj8000
Calcite | Level 5

Thank you for your response. Here's my code snippet:

 

ods noproctitle;
ods graphics / imagemap=on;

proc logistic data=Work.SortTempTableSorted
        plots=(oddsratio(cldisplay=serifarrow) );
    class sex cancer DM / param=glm;
    model PainExists_1y(event='true')=sex cancer DM / link=logit technique=fisher;
    by pre_op_pain;
run;

 

In this case, I want PainExists_1y to be 'true', but I want my classification variable (cancer) to generate odds ratios of true vs. false (right now it's giving me false vs. true). Given your suggestion, where would I add the modification?

Reeza
Super User

In this case, I want PainExists_1y to be 'true', but I want my classification variable (cancer) to generate odds ratios of true vs. false (right now it's giving me false vs. true). Given your suggestion, where would I add the modification?

 

I think you're interpreting it incorrectly or not specifying your event correctly. 

That's exactly what it should be giving you. Check your log to verify what is being modelled. Note that True is not  the same as true as TRUE etc, it is case sensitive. Usually it would be PARAM=REF to get the comparison rather than GLM, but that's ultimately your choice for what suits your analysis.   

 

You'll see a note like this:

NOTE: PROC LOGISTIC is modeling the probability that Pain='No'. One way to change this to model the probability that Pain='Yes' is
to specify the response variable option EVENT='Yes'.
 
You can add expb to the MODEL options to get the ODDS ratio or the ODDSRATIO statement itself to get the ODDS Ratio estimates. 
 
model PainExists_1y(event='true')=sex cancer DM / link=logit technique=fisher expb;
mj8000
Calcite | Level 5

 I think I may have been running my analysis backwards. I think I need to set my "Event of interest" = false, so that any Odds Ratio that I see greater than 1 means there's a higher chance of my event happening. Is this a correct interpretation?

 

Previously I had set my "Event of interest" = true.

Reeza
Super User

If your event is true, you get the odds of getting a true event compared to either a single unit increase for a continuous variable and compared to your reference level with a PARAM=REF model. If you're using GLM, I'm not sure how to interpret the ratio to be honest. 

 

You can work through the second example in PROC LOGISTIC and it has the odds ratio with a categorical predictor and how it's interpreted halfway through and then replicate that on your data once you understand how it works.

 


@mj8000 wrote:

 I think I may have been running my analysis backwards. I think I need to set my "Event of interest" = false, so that any Odds Ratio that I see greater than 1 means there's a higher chance of my event happening. Is this a correct interpretation?

 

Previously I had set my "Event of interest" = true.


 

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
  • 5 replies
  • 1370 views
  • 4 likes
  • 2 in conversation