BookmarkSubscribeRSS Feed
lmyers2
Obsidian | Level 7

Hello,

 

I'm using sas 9.4. I've been reading how to change the title of a survival plot and x-axis but don't understand how to use the following macro I found. Do I run proc template first, then run this macro?  How do I change this macro to get the title to be "Kaplan Meier Plot" and X-axis "Time (weeks)"?

 

%macro SurvivalTemplate;
%local outside;
proc template;
%do outside = 0 %to 1;
define statgraph Stat.Lifetest.Graphics.ProductLimitSurvival%scan(2,2-&outside);
dynamic NStrata xName plotAtRisk %if %nrbquote(&censored) ne %then plotCensored;
plotCL plotHW plotEP labelCL labelHW labelEP maxTime xtickVals xtickValFitPol
rowWeights method StratumID classAtRisk plotBand plotTest GroupName yMin
Transparency SecondTitle TestName pValue _byline_ _bytitle_ _byfootnote_;
BeginGraph;
if (NSTRATA=1)
if (EXISTS(STRATUMID)) entrytitle &titletext1;
else entrytitle &titletext0;
endif;
%if not &outside %then if (PLOTATRISK);
entrytitle "With Number of Subjects at Risk" / textattrs=GRAPHVALUETEXT;
%if not &outside %then %do; endif; %end;
%AtRiskLatticeStart
layout overlay / xaxisopts=(&xoptions) yaxisopts=(&yoptions);
%singlestratum
endlayout;
%AtRiskLatticeEnd
else
entrytitle &titletext2;
if (EXISTS(SECONDTITLE))
entrytitle SECONDTITLE / textattrs=GRAPHVALUETEXT;
endif;
%AtRiskLatticeStart
layout overlay / xaxisopts=(&xoptions) yaxisopts=(&yoptions);
%multiplestrata
endlayout;
%AtRiskLatticeEnd(%str(class=CLASSATRISK))
endif;
if (_BYTITLE_) entrytitle _BYLINE_ / textattrs=GRAPHVALUETEXT;
else if (_BYFOOTNOTE_) entryfootnote halign=left _BYLINE_; endif;
endif;
EndGraph;
end;
%end;
run;
%mend;

 

2 REPLIES 2
lmyers2
Obsidian | Level 7

Thanks 

 

I'm guessing I'm not running the code right because the title remains "Product-Limit Survival Estimate." I also tried to change the code to make the title of the x-axis title "Time (weeks)."  Code is below.

 

proc template;
   define statgraph Stat.Lifetest.Graphics.ProductLimitSurvival;

%ProvideSurvivalMacros                   
%let TitleText0 = "Kaplan-Meier Plot";    
%let TitleText1 = "Time (weeks)";
%let TitleText2 = &titletext0;
%CompileSurvivalTemplates                

ods graphics on;
proc lifetest data=ecmodata plots=survival (cb=hw atrisk(outside(0.15)));
   time survt * status(0);
run;
ods graphics off;

sas-innovate-2024.png

 

Time is running out to save with the early bird rate. Register by Friday, March 1 for just $695 - $100 off the standard rate.

 

Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events. 

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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