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

 

Thanks in advance for your time and I apologize for how naieve my question might be! I am just looking for big-picture input - not expecting code or any specific solution. For the record I am using SAS 9.3 and do not currently have access to SAS 9.4.

 

I am generating a survival plot using PHREG.  I have generated survival plots using two different methods: 1) plots generated within PHREG using the PLOTS = option and 2) plots generated using SGPLOT and the dataset output by the PHREG BASELINE statement.

 

For either of these approaches, is it possible (in SAS 9.3) to generate a survival plot that contains the number of subjects at risk along the x-axis (time)?  I know how to do this in PROC LIFETEST (i.e. by using PROC TEMPLATE); however I can't figure out how to do this in PROC PHREG.  Can I use the same PROC TEMPLATE approach I use for PROC LIFETEST to revise the axis in SGPLOT?

 

I have reviewed the following resources (and drawn the corresponding conclusions):

https://support.sas.com/documentation/cdl/en/statug/63347/HTML/default/viewer.htm#statug_phreg_sect0...

  • This reference seems to indicate that PHREG is capable of generating the ATRISK data.  However, I can't figure out how to incorporate it in the plot. Furthermore, I'm not sure how to output these data in the dataset generated by my BASELINE statement.  However, I assume I can figure out how to join the ATRISK table with my survival table. But this still doesn't solve the problem of how to get it into the plot.

http://blogs.sas.com/content/graphicallyspeaking/2014/02/09/survival-plot/

  • This reference seems to indicate that SAS 9.4 incorporates is capable of doing what I want (i.e. plot ATRISK values using SGPLOT's XAXISTABLE statmenet. However, as far as I can tell, this reference only describes how SAS 9.3 can plot the ATRISK values using PROC LIFETEST. 
1 ACCEPTED SOLUTION

Accepted Solutions
Jay54
Meteorite | Level 14

I am not very familiar with the details of LIFETEST or PHREG, but I have used LIFETEST to generate survival data along with the ATRISK table at intervals.  This data can be saved to a data set using ODS OUTPUT statement.  Then one can use SGPLOT to create the actual survival plot that includes the display of the at risk values.  With SAS 9.4, you can ues XAXISTABLE that has been explicilty built for such use cases to display the at-risk data.  With SAS 9.3, you can display the at-risk data using SGANNOTATE.

 

The paper "Clinical Graphs Using SAS" describes both methods.

View solution in original post

4 REPLIES 4
djrisks
Barite | Level 11

Hi,

 

From my understanding, I thought that Proc Lifetest was for Kaplan-Meier Survival Curves, and Proc PHREG was for Hazard Ratio's, i.e. Forest Plots.

 

Someone else might know more though...

mconover
Quartz | Level 8

PHREG does have the ability to generate survival plots.  In my experience it can be useful in case where you want to generate plots that are adjusted (or weighted) for other factors beyond the strata displayed in the plot (or weighted).  However, perhaps it is limited in other ways (e.g. maybe it can't be used to display ATRISK data).

Jay54
Meteorite | Level 14

I am not very familiar with the details of LIFETEST or PHREG, but I have used LIFETEST to generate survival data along with the ATRISK table at intervals.  This data can be saved to a data set using ODS OUTPUT statement.  Then one can use SGPLOT to create the actual survival plot that includes the display of the at risk values.  With SAS 9.4, you can ues XAXISTABLE that has been explicilty built for such use cases to display the at-risk data.  With SAS 9.3, you can display the at-risk data using SGANNOTATE.

 

The paper "Clinical Graphs Using SAS" describes both methods.

Reeza
Super User

I think you can use the method here. You'll need to generate your data and probably create a custom template using SGTEMPLATE, then use SGRENDER to create your plot. 

http://blogs.sas.com/content/graphicallyspeaking/2011/11/28/survival-plot-with-external-at-risk-tabl...

 

 

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
  • 4 replies
  • 2541 views
  • 0 likes
  • 4 in conversation