Data visualization with SAS programming

Modify text in second title of Kaplan-Meier Curve from Prov Lifetest

Accepted Solution Solved
Reply
New Contributor
Posts: 4
Accepted Solution

Modify text in second title of Kaplan-Meier Curve from Prov Lifetest

Hello,

 

I am working on a Kaplan-Meier Curve Graph from Proc Lifetest. And have foud methods for making modifications to the graph with the exception for the Secondary Title that reads: "With Number of Subjects at Risk"  I found how to suppress it, but, not how to modify. FYI this out put is for Multiple strata. So, I don't need to worry about single strata, unless there is a global variable I can use.

 

Any help would be appreciated.

 

Thanks,

 

ScotTitleExample_29NOV2017.png


Accepted Solutions
Solution
‎11-29-2017 04:02 PM
SAS Super FREQ
Posts: 496

Re: Modify text in second title of Kaplan-Meier Curve from Prov Lifetest

Posted in reply to WarrenKuhfeld

 

BTW, Here is the documentation for nTitles on page 854.

nTitles

specifies the number of titles. Set the macro variable nTitles to 1 to suppress the second title
line or 0 to suppress all title lines. You can add titles to the plot by adding ENTRYTITLE
statements to the top of the %StmtsBeginGraph macro even when you suppress the usual titles
by setting the nTitles macro variable to 0 or 1. By default, nTitles equals 2.

View solution in original post


All Replies
SAS Super FREQ
Posts: 496

Re: Modify text in second title of Kaplan-Meier Curve from Prov Lifetest

[ Edited ]

https://support.sas.com/documentation/onlinedoc/stat/142/kaplan.pdf


This chapter goes into incredible detail on template modification for the KM plot.

 


* one time set up;
data _null_;
   %let url = //support.sas.com/documentation/onlinedoc/stat/ex_code/142;
   infile "http:&url/templft.html" device=url;
   file 'macros.tmp';
   retain pre 0;
   input;
   _infile_ = tranwrd(_infile_, '&', '&');
   _infile_ = tranwrd(_infile_, '&lt;' , '<');
   if index(_infile_, '</pre>') then pre = 0;
   if pre then put _infile_;
   if index(_infile_, '<pre>') then pre = 1;
run;
%inc 'macros.tmp' / nosource;

* Add titles;
%ProvideSurvivalMacros
%let ntitles = 1;
%macro StmtsBeginGraph;
    entrytitle "My Title" / textattrs=GraphDataText;
%mend;
%CompileSurvivalTemplates

ods graphics on;
proc lifetest data=sashelp.BMT
   plots=survival(cb=hw test);
   time T * Status(0);
   strata Group;
run;
New Contributor
Posts: 4

Re: Modify text in second title of Kaplan-Meier Curve from Prov Lifetest

Posted in reply to WarrenKuhfeld

Thank you for the quick reply. I have previoiusly previewed this documentation and the only thing I have seen in it, is how to "suppress" the secondary title (Pg 843 (%let ntitles = 1Smiley Wink)

.....nothing on how to "modify" the secondary title.  My investigator would like to change it from "With Number of Subjects at Risk" to "Number of Subjects at Risk for Impairment". The main title is easy to modify, but I see no variable that I can use to modify the secondary.

SAS Super FREQ
Posts: 496

Re: Modify text in second title of Kaplan-Meier Curve from Prov Lifetest

The example in the chapter shows you how to add a footnote.  It is the same thing; you just do a title instead of a footnote.  I modified my original response to show you an example.

New Contributor
Posts: 4

Re: Modify text in second title of Kaplan-Meier Curve from Prov Lifetest

Posted in reply to WarrenKuhfeld
I see and understand those items in the examples in that documentation.......but....beyond suppressing the secondary title, I see nothing on "MODIFYING" the text of the secondary...It has to be something simple. I tried the generic Proc Template to see the SAS generated code, but nothing in there is obvious or effective for me.
SAS Super FREQ
Posts: 496

Re: Modify text in second title of Kaplan-Meier Curve from Prov Lifetest

Again, I showed you precisely what to do when I modified my first reply.  I just took the example from page 843 and added a new title instead of a new footnote.  I admit this all does require some study and understanding of what the macros are achieving and how they achieve it.

Solution
‎11-29-2017 04:02 PM
SAS Super FREQ
Posts: 496

Re: Modify text in second title of Kaplan-Meier Curve from Prov Lifetest

Posted in reply to WarrenKuhfeld

 

BTW, Here is the documentation for nTitles on page 854.

nTitles

specifies the number of titles. Set the macro variable nTitles to 1 to suppress the second title
line or 0 to suppress all title lines. You can add titles to the plot by adding ENTRYTITLE
statements to the top of the %StmtsBeginGraph macro even when you suppress the usual titles
by setting the nTitles macro variable to 0 or 1. By default, nTitles equals 2.

New Contributor
Posts: 4

Re: Modify text in second title of Kaplan-Meier Curve from Prov Lifetest

Posted in reply to WarrenKuhfeld
While the this works for my purposes, it doesn't actually perform the requested action.....I find it interesting that the only documented way to modify the secondary title is through "brute force." The code doesn't actually modify but forces a replacement. First, with the %StmtsBeginGraph macro - where it writes the secondary title before it writes anything else. Then, by suppressing the original secondary title. with the Let statement
%Let ntitles = 1;

What if I wanted to just modify the style or font of the secondary Title? where would I do that? where is that documentation? It is rhetorical as I think that is where we could modify the text. But thank you for the quick solution. Blessings.
SAS Super FREQ
Posts: 496

Re: Modify text in second title of Kaplan-Meier Curve from Prov Lifetest

You can modify every graph by modifying the graph template.  I wrote an entire chapter on that topic. http://support.sas.com/documentation/onlinedoc/stat/142/templt.pdf

 

In addition, as we discussed, I wrote an entire chapter on just modifying the KM plot. http://support.sas.com/documentation/onlinedoc/stat/142/kaplan.pdf

 

My colleagues and myself have additionally written papers and given presentations on the GTL and template modification.  My colleagues have also written all the GTL documentation.

 

On page 917 I show precisely what the old title was.  In the chapter, I show how to do every template modification that the PROC LIFETEST developer, technical support, and customers have told me that they wanted.  No one ever told me that they wanted to modify the second title before; people often ask to modify the first title.  Nevertheless, I built in a way to modify the second title and I documented it. When you asked, I quickly modified the most relevant example and provided it to you along with pointers to where all of the information was in the documentation. I can't really do much more than that!  If that is not satisfactory, you can always dump out the entire template and edit rather than replace the title. 

 

To answer your last questions, you are providing the entire entrytitle statement in the code I showed you.  You can specify any entrytitle statement you want with any combination of options that the entrytitle statement supports. I cannot anticipate everything that everyone wants to do, so I did my best to provide maximum flexibility and documentation.  Still, it is a big template (two templates really), so the I can't fit all of the relevant documentation in a single page.  Yes, there is a bit of a learning curve because no other templates have been macroized like this, but the macroized templates give you incredible power to create highly customized KM plots.  I hope this helps.

SAS Super FREQ
Posts: 496

Re: Modify text in second title of Kaplan-Meier Curve from Prov Lifetest

Posted in reply to WarrenKuhfeld

As I mentioned, the KM chapter shows every modification that to my knowledge a customer has requested.  Hence, I just finished a new example for the next software release that shows how to replace the second title.  It also tells you where in the chapter to find the original second title.  Actually, this is the third new example that I have added for the next release.  I do not know at this point when this documentation or the next software update will be released.

☑ This topic is solved.

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

Discussion stats
  • 9 replies
  • 170 views
  • 0 likes
  • 2 in conversation