I'm able to generate a nice plot of Product Limit Survival Estimate via PROC LIFETEST, and even capture it in an .rtf file. I'm wondering if there are any ways to customize it:
1) add titles and footnote
2) remove tabular output that LIFETEST generates from the .rtf file that contains the plot.
Maybe the answer is to write the plotting code myself instead of relying on generic LIFETEST output. I tried extracting the time and survival rate data using this statement:
ods output survivalplot=zz; * capture the time and survival rates in a data set **;
But I tried a simple GSPLOT line plot and it didn't have that squared-off look that a survival plot usually has.
It seems like this is a common type of display, so it's frustrating that I can't figure it out. Anybody have any ideas?
Thanks,
...dave
It is not hard to find. Google "customize kaplan meier plot sas"
This is the first link (at least for me).
There's a chapter on that in the documentation with macros to help you modify the templates.
@davehalltwp wrote:
Hi Reeza,
The chapter would deal with modifying the templates in order to make my plot look more like a typical survival plot?
I don't know what you mean by typical survival plot, but it does what you asked for in your question, modify titles. Look into it.
You can control the output to RTF with ODS SELECT/EXCLUDE, so use ODS SELECT <survivalgraph>; to only include the survival graph in your RTF output.
It is not hard to find. Google "customize kaplan meier plot sas"
This is the first link (at least for me).
Thanks, Warren. I did read your chapter today, so I'm honored to hear from you.
I'll look at it again tomorrow. It looked like possibly too much for me to digest and use with a quick enough turn around, unfortunately. I might just have to go with the generic output and hope nobody complains.
Thanks!
There *IS* a lot in the chapter, but much of the chapter contains small, fully-self-contained examples that you copy and use or slightly modify. You can also combine them.
If you use the macro approach, be sure to note the code at the beginning of that part of the chapter that tells you how to copy the macros from the web and include them.
Thanks to both of you for your help.
Warren, your chapter is well-written. I made a copy of the template macros, and was able to call them after setting %LET statements to change aspects of my plot. In other words, it's working for me!
Now I need to act on Reeza's suggestion for using ODS Select to keep only the plot in my .rtf file. I've never used such a statement. On the other hand, I never did this other stuff either.
Thanks!
Add the following before your PROC, that's it 😉
ods select survivalplot;
Glad I could help! @Reezaof course is correct about ODS SELECT and ODS EXCLUDE. See this blog for advanced ways to control the output.
My plots look really sharp now.
The only issue I have is that a heading of "The LIFETEST Procedure" appears just above the plot. I have scoured the chapter and see neither a mention of this string of text nor a mention of getting rid of it. It's the title that appears at the top of standard PROC LIFETEST output.
This time I'll try to figure it out for myself, you all have done enough!
It is not in that chapter because it is a general ODS thing. Specify this statement to get rid of it.
ods noproctitle;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.