Data visualization with SAS programming

Is it possible to add ATRISK data to a survival plot generated using PHREG or PHREG+SGPLOT?

Accepted Solution Solved
Reply
Contributor
Posts: 50
Accepted Solution

Is it possible to add ATRISK data to a survival plot generated using PHREG or PHREG+SGPLOT?

[ Edited ]

 

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. 

Accepted Solutions
Solution
‎07-08-2016 09:32 AM
SAS Super FREQ
Posts: 1,080

Re: Is it possible to add ATRISK data to a survival plot generated using PHREG or PHREG+SGPLOT?

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


All Replies
Super Contributor
Posts: 252

Re: Is it possible to add ATRISK data to a survival plot generated using PHREG or PHREG+SGPLOT?

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...

Contributor
Posts: 50

Re: Is it possible to add ATRISK data to a survival plot generated using PHREG or PHREG+SGPLOT?

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).

Solution
‎07-08-2016 09:32 AM
SAS Super FREQ
Posts: 1,080

Re: Is it possible to add ATRISK data to a survival plot generated using PHREG or PHREG+SGPLOT?

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.

Grand Advisor
Posts: 17,338

Re: Is it possible to add ATRISK data to a survival plot generated using PHREG or PHREG+SGPLOT?

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...

 

 

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 396 views
  • 0 likes
  • 4 in conversation