BookmarkSubscribeRSS Feed
GS2
Obsidian | Level 7 GS2
Obsidian | Level 7

Hello,

 

Using SAS 9.4

 

I am trying to change the title of a proc lifetest but using the %ProvideSurvivalMacros and the documentation that comes from here (https://support.sas.com/documentation/cdl/en/statug/67523/HTML/default/viewer.htm#statug_kaplan_sect...).

 

However, I cannot seem to get the title to change. I have attached my code because I am obviously missing something. Any help would be greatly appreciated. Thank you

data _null_;
   %let url = //support.sas.com/documentation/onlinedoc/stat/ex_code/132;
   infile "http:&url/templft.html" device=url;
   file 'macros.tmp';
   retain pre 0;
   input;
   if index(_infile_, '</pre>') then pre = 0;
   if pre then put _infile_;
   if index(_infile_, '<pre>')  then pre = 1;
run;
%inc 'macros.tmp' / nosource;
%ProvideSurvivalMacros                  
%let TitleText0 = "Figure 1";
%CompileSurvivalTemplates   
ODS LISTING image_dpi=300 GPATH = 'path' style=statistical;
ODS GRAPHICS ON / IMAGENAME = "Figure 1" IMAGEFMT=tiff HEIGHT=5in WIDTH=15cm 
	attrpriority=Color; 
proc lifetest data=cr.analysis OUTCIF=cif_output atrisk plots=cif(test) maxtime=600 NINTERVAL=100 timelist= 0 25 50 75 100 200 300 400 500 600;
	time tt_censor_date*binary_amputation(0)/eventcode=1;
	label tt_censor_date = 'Time (in wks) from DOS to Censor Date'
			gender = 'Gender';
	strata gender;
	ods output GrayTest=graytest;
run;
proc template;
   delete Stat.Lifetest.Graphics.ProductLimitSurvival  /
          store=sasuser.templat;
   delete Stat.Lifetest.Graphics.ProductLimitSurvival2 /
          store=sasuser.templat;
run;
4 REPLIES 4
ballardw
Super User

Sometimes you need to read the fine print as well as the code example. From the linked documentation page: (emphasis added )

 

There are multiple title macro variables because two different types of plots are defined in the survival plot templates. The first macro variable, TitleText0, contains the text that is the same for both types of plots. The second macro variable, TitleText1, contains the title for the single-stratum case. The third macro variable, TitleText2, contains the title for the multiple-strata case. Both TitleText1 and TitleText2 use the common text defined in TitleText0. Both TitleText0 and TitleText2 were changed from their original definition; the definition of TitleText1 was copied from the %ProvideSurvivalMacros macro. You must provide all relevant %LET statements when you modify TitleText0. In this case it is TitleText0 and TitleText2, but it is easy to copy all three and then just modify what you need. Alternatively, when you know the number of strata, you can modify only TitleText1 or TitleText2.

 

So add the the other 2 TitleText macro variables and you should be good to go.

GS2
Obsidian | Level 7 GS2
Obsidian | Level 7

I added the 2 lines and that did not fix the problem. Do you have any other thoughts on why this is not working? Thank you

data _null_;
   %let url = //support.sas.com/documentation/onlinedoc/stat/ex_code/132;
   infile "http:&url/templft.html" device=url;
   file 'macros.tmp';
   retain pre 0;
   input;
   if index(_infile_, '</pre>') then pre = 0;
   if pre then put _infile_;
   if index(_infile_, '<pre>')  then pre = 1;
run;
%ProvideSurvivalMacros                   
%let TitleText0 = "Figure 1";
%let TitleText1 = &titletext0 " for " STRATUMID;
%let TitleText2 = &titletext0;
%CompileSurvivalTemplates   
ODS LISTING image_dpi=300 GPATH = 'path' style=statistical;
ODS GRAPHICS ON / IMAGENAME = "Figure 1" IMAGEFMT=tiff HEIGHT=5in WIDTH=15cm 
	attrpriority=Color; 
proc lifetest data=cr.analysis OUTCIF=cif_output atrisk plots=cif(test) maxtime=600 NINTERVAL=100 timelist= 0 25 50 75 100 200 300 400 500 600;
	time tt_censor_date*binary_amputation(0)/eventcode=1;
	label tt_censor_date = 'Time (in wks) from DOS to Censor Date'
			gender = 'Gender';
	strata gender;
	ods output GrayTest=graytest;
run;
proc template;
   delete Stat.Lifetest.Graphics.ProductLimitSurvival  /
          store=sasuser.templat;
   delete Stat.Lifetest.Graphics.ProductLimitSurvival2 /
          store=sasuser.templat;
run;
ballardw
Super User

I don't have your data so cannot run all your code.

 

Is your log showing any warnings or errors? If so, set OPTIONS MPRINT; to get details of what is happening when the macros run and see if that shows anything.

GS2
Obsidian | Level 7 GS2
Obsidian | Level 7
I realize the lack of data is a challenge. The log does not have any obvious errors, at least to me. Thank you for your attempts

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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