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,
Scot
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.
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_, '<' , '<');
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;
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.
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.
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.
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.
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.
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.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.