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

Thank you for this very helpful page!
I have used the EFFECT statement together with PROC LOGISTIC. But I haven't figured out how to modify the code in order to plot odds ratios on the y axis, instead of logit or predicted values. Is it possible to do that?

[example]

ods select ANOVA ParameterEstimates SplineKnots;
proc logistic data=cars;
  effect spl = spline(weight / details naturalcubic basis=tpf(noint)                
                               knotmethod=percentiles(5) );
   model mpg_city = spl / selection=none;     
   output out=SplineOut predicted=Fit;        
quit;
 
proc sgplot data=SplineOut noautolegend;
   scatter x=weight y=mpg_city;
   series x=weight y=Fit / lineattrs=(thickness=3 color=red);
run;

[sample figure]

 
 
 

example.jpg

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

Here is a worked out example based on @StatDave advice, including how to flip the graph

 

proc logistic data=sashelp.heart;
where BP_status ne "Optimal";
  effect spl = spline(weight / details naturalcubic basis=tpf(noint)                
                               knotmethod=percentiles(5) );
   model BP_status(event="High") = spl / selection=none alpha=0.1;     
   units weight=10;
   oddsratio weight / at(weight=110 to 210 by 2) cl=pl;  
   ods output ORPlot=orp;
quit;

data orpGraph;
set orp;
Weight = input(scan(DisplayLabel, 2, "="), best.);
label weight="Weight (lbs)";
run;

proc sgplot data=orpGraph noautolegend;
band x=weight upper=upperCLdisplay lower=lowerCLdisplay;
series x=weight y=OddsRatioEstDisplay;
yaxis label="Odds Ratio of High BP for 10 lbs Weight Increase";
run;

example.png

PG

View solution in original post

3 REPLIES 3
Ksharp
Super User
Please post it at Statistic Forum . @Rick_SAS @StatDave
PGStats
Opal | Level 21

Here is a worked out example based on @StatDave advice, including how to flip the graph

 

proc logistic data=sashelp.heart;
where BP_status ne "Optimal";
  effect spl = spline(weight / details naturalcubic basis=tpf(noint)                
                               knotmethod=percentiles(5) );
   model BP_status(event="High") = spl / selection=none alpha=0.1;     
   units weight=10;
   oddsratio weight / at(weight=110 to 210 by 2) cl=pl;  
   ods output ORPlot=orp;
quit;

data orpGraph;
set orp;
Weight = input(scan(DisplayLabel, 2, "="), best.);
label weight="Weight (lbs)";
run;

proc sgplot data=orpGraph noautolegend;
band x=weight upper=upperCLdisplay lower=lowerCLdisplay;
series x=weight y=OddsRatioEstDisplay;
yaxis label="Odds Ratio of High BP for 10 lbs Weight Increase";
run;

example.png

PG
StatDave
SAS Super FREQ

A plot of the odds ratios can be made using the ODDSRATIO statement as shown below. The plot is rotated compared to the example you show but conveys the same information. The following statements use the data in the example titled "Nonparametric Logistic Regression" in the PROC GAMPL documentation.

 

proc logistic data=diabetesstudy;
  effect spl = spline(age / details naturalcubic basis=tpf(noint)                
                               knotmethod=percentiles(5) );
   model diabetes(event="1") = spl ;     
   oddsratio age / at(age=20 to 60 by 10);
run;

 

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
  • 3 replies
  • 3028 views
  • 9 likes
  • 4 in conversation