BookmarkSubscribeRSS Feed
Mirte
Calcite | Level 5
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;

Hi All, 

 

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 REPLIES 10
WarrenKuhfeld
Rhodochrosite | Level 12

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?

Mirte
Calcite | Level 5

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. 

WarrenKuhfeld
Rhodochrosite | Level 12

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

http://support.sas.com/documentation/onlinedoc/stat/141/odsgraph.pdf 

Mirte
Calcite | Level 5

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? 

WarrenKuhfeld
Rhodochrosite | Level 12

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.

WarrenKuhfeld
Rhodochrosite | Level 12

Just dawned on me.  By RCS, do you mean restricted cubic splines?  I really don't know what plot you are looking for.

Mirte
Calcite | Level 5

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.

 spline.png

WarrenKuhfeld
Rhodochrosite | Level 12

Sorry I can't be more help. Now that you have shown what you want, I hope someone else can help you.  

Mirte
Calcite | Level 5

No problem. I appreciate you taking the time!

asarode
Calcite | Level 5

Hi Mrite,

 

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;
run;
ods graphics on;

 

However, I do not see any plot/graph in the SAS output. Did you find any solution for your code?

 

 

sas-innovate-2024.png

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
  • 10 replies
  • 3653 views
  • 3 likes
  • 3 in conversation