BookmarkSubscribeRSS Feed
Fluorite | Level 6


I am conducting an analysis to evaluate the relationship between several binary outcomes (death, blood transfusion, 30-day readmission) and a continuous predictor (number of surgeries done at a hospital). I would also like to adjust my model for covariates (age, sex, cardiac anomaly). My objective is to visually examine whether there exists an inflection point, indicating a number of surgeries, where the probability of the outcome changes. 


There is a paper by Ravi et al. ( that conducted an analysis similar to what I'm hoping to do, using restricted cubic spline plots.


My current approach was to use PROC LOGISTIC with the EFFECTS function for restricted cubic splines, and then plot the predicted probabilities, but I am having trouble with graphing the output though and could use some help. I also appreciate any feedback on my approach/coding in general.


So far, this is what I am using:

proc logistic data = have outdesignonly;
effect spl = spline (surgeries / details naturalcubic basis= tpf(noint) knotmethod= percentiles(3));
class sex (ref=0) cardiac_anomaly (ref=0)/ param=ref;
model blood_transfusion = surgeries age sex cardiac_anomaly;
output out= splineout predicted= fit;

title "Restricted Cubic Spline Regression for Blood Transfusion";
proc sgplot data= splineout noautolegend;
scatter x= surgeries y=fit/ lineattrs= (thickness =3 color=red);

I have chosen 3 knots because my sample is relatively small (n ~500). 


Eventually, I would like to be able to plot an overlay plot for the various outcomes, but I am also unclear on how this could be achieved. 


Thank you in advance for any suggestions!

Super User
You didn't include spline effect SPL in your model.
You could try EFFECTPLOT statement of PROC LOGISTIC or PROC PLM.

proc logistic data=curry;
where Shot_Distance <= 30;
effect spl = spline(X Y / degree=2);
model Shot_Made(event='Made') = spl / SCALE=NONE AGGREGATE;
effectplot contour / showCLegend;
Fluorite | Level 6

Thank you for your response.

It seems I'm able to plot the predicted probabilities of my model using Proc PLM and EFFECTPLOT. The code I am using is:

proc logistic data = have;
effect spl= spline(surgeries/ details naturalcubic basis=tpf(noint) knotmethod=percentiles(4));
class sex cardiac_anomaly/ param =ref;
model blood_transfusion (event ='1') = surgeries age sex cardiac_anomaly spl;
store Model;

proc plm source = Model;
effectplot fit (x=surgeries)/ at (sex ='0' cardiac_anomaly ='0');

I would appreciate any feedback on my model; the way I understand it, is that the cubic spline regression predictions are plotted, showing trends within my data. I am unable to share my plots unfortunately, but they do ressemble those in:


Thank you!


Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.


Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 2 in conversation