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

Hi All,

 

When I ask for plots in proc phreg and use the baseline covariates statement to ask for a direct adjusted plot, the title "Direct Adjusted Survivor Functions" appears. How do I get rid of this? I have tried modifying the title by using ods trace to find the template for the survival graph and modify the proc template code. However, the template 'Stat.Phreg.Graphics.Survival' does not have a title with "Direct Adjusted Survivor Functions." Is this the correct template for this graph? If so, how can I modify the code below to get rid of the title?

 

Thanks!

Sarah

 

proc template;
source Stat.Phreg.Graphics.Survival;
define statgraph Stat.PHReg.Graphics.Survival;
dynamic title1 title2 title3 title4 xviewMin xviewMax group groupIndex
groupName plotCL plotHPD transparency piecewise _byline_ _bytitle_
_byfootnote_;
BeginGraph;
entrytitle TITLE1 TITLE3;
entrytitle TITLE2 TITLE4 / textattrs=GRAPHVALUETEXT;
layout overlay / xaxisopts=(linearopts=(viewmin=XVIEWMIN viewmax=
XVIEWMAX)) yaxisopts=(label="Survival Probability" shortlabel=
"Survival" linearopts=(viewmin=0 viewmax=1 tickvaluelist=(0 .2
.4 .6 .8 1.0)));
if (PLOTCL)
bandplot LimitLower=LOWERSURVIVAL LimitUpper=UPPERSURVIVAL x=
TIME / group=GROUP index=GROUPINDEX modelname="Survival"
datatransparency=transparency;
endif;
if (PLOTHPD)
bandplot LimitLower=LOWERHPDSURVIVAL LimitUpper=
UPPERHPDSURVIVAL x=TIME / group=GROUP index=GROUPINDEX
modelname="Survival" datatransparency=transparency;
endif;
if (EXISTS(PIECEWISE))
seriesplot y=SURVIVAL x=TIME / group=GROUP index=GROUPINDEX
name="Survival";
else
stepplot y=SURVIVAL x=TIME / group=GROUP index=GROUPINDEX
name="Survival";
endif;
if (EXISTS(GROUP))
discretelegend "Survival" / location=outside title=GROUPNAME;
endif;
endlayout;
if (_BYTITLE_)
entrytitle _BYLINE_ / textattrs=GRAPHVALUETEXT;
else
if (_BYFOOTNOTE_)
entryfootnote halign=left _BYLINE_;
endif;
endif;
EndGraph;
end;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

The SAS/STAT documentation discusses several ways to change the titles (and other features) of the ODS graphics. For the title, you can read the section "ODS Graphics Template Modification: Changing Titles by Using the %GrTitle Macro"

 

Here is the %GrTitle macro applied to the survival plot in PROC PHREG. The example and data are from the Getting Started example in the doc.

 

/* Example from Getting Started example for PHREG procedure */
data Rats;
   label Days  ='Days from Exposure to Death';
   input Days Status Group @@;
   datalines;
143 1 0   164 1 0   188 1 0   188 1 0
190 1 0   192 1 0   206 1 0   209 1 0
213 1 0   216 1 0   220 1 0   227 1 0
230 1 0   234 1 0   246 1 0   265 1 0
304 1 0   216 0 0   244 0 0   142 1 1
156 1 1   163 1 1   198 1 1   205 1 1
232 1 1   232 1 1   233 1 1   233 1 1
233 1 1   233 1 1   239 1 1   240 1 1
261 1 1   280 1 1   280 1 1   296 1 1
296 1 1   323 1 1   204 0 1   344 0 1
;

data Regimes;
   Group=0;   output;
   Group=1;   output;
run;

ods trace on;
ods graphics on;
proc phreg data=Rats plot(overlay)=survival;
   model Days*Status(0)=Group;
   baseline covariates=regimes out=_null_;
run;
ods trace off;

%grtitle(path=Stat.Phreg.Graphics.Survival)

%let PHReg_Survival = The Title of My Plot;
%let PHReg_Survival2 = An optional subtitle;
proc phreg data=Rats plot(overlay)=survival;
   model Days*Status(0)=Group;
   baseline covariates=regimes out=_null_;
run;

View solution in original post

2 REPLIES 2
Rick_SAS
SAS Super FREQ

The SAS/STAT documentation discusses several ways to change the titles (and other features) of the ODS graphics. For the title, you can read the section "ODS Graphics Template Modification: Changing Titles by Using the %GrTitle Macro"

 

Here is the %GrTitle macro applied to the survival plot in PROC PHREG. The example and data are from the Getting Started example in the doc.

 

/* Example from Getting Started example for PHREG procedure */
data Rats;
   label Days  ='Days from Exposure to Death';
   input Days Status Group @@;
   datalines;
143 1 0   164 1 0   188 1 0   188 1 0
190 1 0   192 1 0   206 1 0   209 1 0
213 1 0   216 1 0   220 1 0   227 1 0
230 1 0   234 1 0   246 1 0   265 1 0
304 1 0   216 0 0   244 0 0   142 1 1
156 1 1   163 1 1   198 1 1   205 1 1
232 1 1   232 1 1   233 1 1   233 1 1
233 1 1   233 1 1   239 1 1   240 1 1
261 1 1   280 1 1   280 1 1   296 1 1
296 1 1   323 1 1   204 0 1   344 0 1
;

data Regimes;
   Group=0;   output;
   Group=1;   output;
run;

ods trace on;
ods graphics on;
proc phreg data=Rats plot(overlay)=survival;
   model Days*Status(0)=Group;
   baseline covariates=regimes out=_null_;
run;
ods trace off;

%grtitle(path=Stat.Phreg.Graphics.Survival)

%let PHReg_Survival = The Title of My Plot;
%let PHReg_Survival2 = An optional subtitle;
proc phreg data=Rats plot(overlay)=survival;
   model Days*Status(0)=Group;
   baseline covariates=regimes out=_null_;
run;
sarahsasuser
Quartz | Level 8
This worked! Thanks!

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 2634 views
  • 1 like
  • 2 in conversation