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

Hello,

 

Does anyone know how I can change the line attributes in PROC PHREG? I'd like to make my lines thicker.I tried editing the 'Stat.Phreg.Graphics.Survival' template which is used for producing survival plot but I couldn't find out which part of code is addressing the line attributes.

The codes for 'Stat.Phreg.Graphics.Survival' template:

 

proc template;

define 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;
 
 
Thanks,
Gelareh
1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

You can change it on the STEPPLOT statement using a linethicknessmax and min options?

 

stepplot y=SURVIVAL x=TIME / group=GROUP index=GROUPINDEX  linethicknessmax=5 linethicknessmin=5 name="Survival";

I don't know what the units are so pretty much guess and test from that point would be my suggestion. 

 

https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.5&docsetId=grstatgraph&docsetTarget=...

 


@Gelareh wrote:

Hello,

 

Does anyone know how I can change the line attributes in PROC PHREG? I'd like to make my lines thicker.I tried editing the 'Stat.Phreg.Graphics.Survival' template which is used for producing survival plot but I couldn't find out which part of code is addressing the line attributes.

The codes for 'Stat.Phreg.Graphics.Survival' template:

 

proc template;

define 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;
 
 
Thanks,
Gelareh

 

View solution in original post

3 REPLIES 3
Reeza
Super User

You can change it on the STEPPLOT statement using a linethicknessmax and min options?

 

stepplot y=SURVIVAL x=TIME / group=GROUP index=GROUPINDEX  linethicknessmax=5 linethicknessmin=5 name="Survival";

I don't know what the units are so pretty much guess and test from that point would be my suggestion. 

 

https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.5&docsetId=grstatgraph&docsetTarget=...

 


@Gelareh wrote:

Hello,

 

Does anyone know how I can change the line attributes in PROC PHREG? I'd like to make my lines thicker.I tried editing the 'Stat.Phreg.Graphics.Survival' template which is used for producing survival plot but I couldn't find out which part of code is addressing the line attributes.

The codes for 'Stat.Phreg.Graphics.Survival' template:

 

proc template;

define 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;
 
 
Thanks,
Gelareh

 

JeffMeyers
Barite | Level 11
Hello, There are a couple of ways to do this. First would be to go through the template and for each of the STEPPLOT or SERIESPLOT statements add a LINEATTRS=(thickness=N) where N is the size that you want the line to be (2pt, 3pt, 4px, etc). This would be added after the / in the plot statements. The other option (since I don't like to change templates but design my own graphs) would be to output the survival plot dataset from PHREG directly and then make an SGPLOT or GTL template to make it look exactly what you want. Add ODS OUTPUT SURVIVALPLOT=_surv; prior to the PHREG code and it should output what you need to plot your own graph in the _surv (or whatever you want to name the dataset) dataset.
Gelareh
Calcite | Level 5
Thank you! That was very helpful

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 3 replies
  • 1105 views
  • 1 like
  • 3 in conversation