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

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

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenKuhfeld
Rhodochrosite | Level 12

 

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

9 REPLIES 9
WarrenKuhfeld
Rhodochrosite | Level 12

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;
MsfStl
Fluorite | Level 6

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 = 1;))

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

WarrenKuhfeld
Rhodochrosite | Level 12

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.

MsfStl
Fluorite | Level 6
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.
WarrenKuhfeld
Rhodochrosite | Level 12

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.

WarrenKuhfeld
Rhodochrosite | Level 12

 

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.

MsfStl
Fluorite | Level 6
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.
WarrenKuhfeld
Rhodochrosite | Level 12

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.

WarrenKuhfeld
Rhodochrosite | Level 12

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 9 replies
  • 2198 views
  • 0 likes
  • 2 in conversation