10-25-2017 09:37 AM
PROC PHREG DATA=XXX; effect fibreS = spline(fibre / basis=tpf(noint) NATURALCUBIC details knotmethod=rangefractions(0.05 0.50 0.95) ); model survival*Censor(0)=fibreS / rl ; run;
For a project, I want to perform restricted cubic splines since my prop. hazard analyses indicate the association between fibre and survival might not be linear.
However, I am not really used working with SAS and I got stuck making my syntax. I think the part I have is alright, however, I do not seem to get any graphical output figures. Could someone help me with the last part?
Thanks in advance!
10-25-2017 09:46 AM
Did you enable ODS Graphics?
ods graphics on;
It might or might not be enabled by default.
Do the graphs you want need to be requested by the PLOTS= option in the PROC statement or by specifying the EFFECTPLOT statement?
10-25-2017 09:51 AM
Thanks for your reply. I have ods graphics enabled.
I thought the graphics needed to be requested with proc plot or proc sgplot, but as I am relatively new to sas I'm sure whether this is right.
10-25-2017 09:55 AM - edited 10-25-2017 09:56 AM
PROC PLOT is ancient technology. Don't use it. PROC SGPLOT is enormously useful, but you might or might not need it. Many procedures automatically create some graphs relevant to the analysis and optionally create others. Look at the PHREG doc. For more about ODS Graphics and SAS/STAT procs, see
10-25-2017 10:30 AM
Thank you for the document. I do not see an option to plot RCS within this document. Do I need to perform another step to create graphs?
10-25-2017 12:33 PM
Indeed I do not find "RCS" in the PROC PHREG documentation, so unless it has some other name, you might have to use PROC SGPLOT.
10-25-2017 12:34 PM
Just dawned on me. By RCS, do you mean restricted cubic splines? I really don't know what plot you are looking for.
10-25-2017 12:43 PM
I have a picture added to my reply. Yes, I mean restricted cubic splines. I want a plot with the hazard ratio on the y-axis and fiber intake on the x-axis. If I run my syntax, I get some output in tables. The same kind of output you would get if you would run a proc phreg without spline specified in the effects statement.
2 weeks ago
I am doing the same analysis as yours. The hazard analysis shows that the association between Bicarb (LBXSC3SI) and survival is not linear. Thus, I want to plot restricted cubic splines in proportional hazard regression.
I used the following code
PROC PHREG DATA = survey;
effect LBXSC3SIs = spline(LBXSC3SI / basis=tpf(noint) NATURALCUBIC details knotmethod=rangefractions(0.05 0.50 0.95) );
model years*dead (0) = LBXSC3SIs / rl;
ods graphics on;
However, I do not see any plot/graph in the SAS output. Did you find any solution for your code?