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

 

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

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenKuhfeld
Ammonite | Level 13

It is not hard to find.  Google "customize kaplan meier plot sas"

 

This is the first link (at least for me).

 
I wrote this chapter.  If there is something you need that is not there, let me know.  The chapter is based on years of feedback from customers. 

View solution in original post

12 REPLIES 12
Reeza
Super User

There's a chapter on that in the documentation with macros to help you modify the templates. 

davehalltwp
Quartz | Level 8
Hi Reeza,

The chapter would deal with modifying the templates in order to make my plot look more like a typical survival plot?
Reeza
Super User

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

 

 

WarrenKuhfeld
Ammonite | Level 13

It is not hard to find.  Google "customize kaplan meier plot sas"

 

This is the first link (at least for me).

 
I wrote this chapter.  If there is something you need that is not there, let me know.  The chapter is based on years of feedback from customers. 
davehalltwp
Quartz | Level 8

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!

WarrenKuhfeld
Ammonite | Level 13

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.

davehalltwp
Quartz | Level 8

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!

Reeza
Super User

Add the following before your PROC, that's it 😉

 

ods select survivalplot;

 

 

WarrenKuhfeld
Ammonite | Level 13

Glad I could help!  @Reezaof course is correct about ODS SELECT and ODS EXCLUDE.  See this blog for advanced ways to control the output.

https://blogs.sas.com/content/graphicallyspeaking/2017/08/14/advanced-ods-controlling-precisely-outp...

davehalltwp
Quartz | Level 8

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!

WarrenKuhfeld
Ammonite | Level 13

It is not in that chapter because it is a general ODS thing.  Specify this statement to get rid of it.

 

ods noproctitle;

davehalltwp
Quartz | Level 8
Thanks, Warren. I can't believe how much I don't know about SAS after all these years!

SAS Innovate 2025: Register Now

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!

What is ANOVA?

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.

Discussion stats
  • 12 replies
  • 3419 views
  • 2 likes
  • 3 in conversation