Hi,
I was able to output a a restricted cubic spline (through effectplot statement in proc logistic) between my independent variable and binary outcome, sliced by a grouping variable. I would now like to change the axis and am trying to figure out how to save a "Logfit" output that also includes my additional grouping variable. I am then planning to recreate this graph in proc sgplot. I have noted the two main questions I have in red below.
Thanks for your help!
proc logistic data=splines descending; class ruca(ref="1_urbancore") / param=ref; effect spl = spline(responsetime/ details naturalcubic basis=tpf(noint)knotmethod=percentiles(5)); model neurooutcome = ruca spl ruca*spl / expb cl outpred=Pred; effectplot slicefit (x=responsetime sliceby=ruca) / noobs clm; ods output fitplot=Logfit; (I was not able to output the LogFit with a group variable?) run; proc sgplot data=Logfit noautolegend; (how to I add a statement to indicate the separate series for a group variable?) band upper=_uclm lower=_lclm x=_xcont1 / transparency=.3; series y=_predicted x=_xcont1; xaxis values=(0 to 1200 by 100) grid offsetmin=.05 offsetmax=.05; yaxis values=(0 to 0.2 by 0.05) grid offsetmin=.05 offsetmax=.05 label="Predicted Probability of Survival with CPC 1 or 2"; title "Effect of RT"; run;
I suspect the problem is that you are using the wrong name for the object that you are trying to save. It is probably SliceFitPanel rather than FitPlot. You can use ODS TRACE ON to find out:
ods trace on;
proc logistic data= ...;
...
ods output SliceFitPanel=LogFit;
run;
ods trace off;
if you are unfamiliar with ODS TRACE, see this article about how to use the ODS OUTPUT statement.
I suspect the problem is that you are using the wrong name for the object that you are trying to save. It is probably SliceFitPanel rather than FitPlot. You can use ODS TRACE ON to find out:
ods trace on;
proc logistic data= ...;
...
ods output SliceFitPanel=LogFit;
run;
ods trace off;
if you are unfamiliar with ODS TRACE, see this article about how to use the ODS OUTPUT statement.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.