BookmarkSubscribeRSS Feed
Anita_n
Pyrite | Level 9

Hi all, 

I have a question about customising the proc lifetest curve for strata=panel. Which part of the proc lifetest template does that (I used this template on this link)   https://support.sas.com/documentation/onlinedoc/stat/ex_code/142/templft.html

Here is the code I used  for the normal curve without strata=panel. I wish to customise strata =panel the same way.

 

%ProvideSurvivalMacros
%let tatters = textattrs=(size=12pt weight=bold family='Calibri' color=cornflowerblue);
%let TitleText2 = "Overall Survival-Kaplan-Meier (RCC)"/&tatters; /* Change the title. */
%let nTitles = 1;
%let GraphOpts = DesignHeight=400px;
%let LegendOpts = ;
%let InsetOpts = ;

%let yOptions = label="survivalrate"
shortlabel= "survival" labelattrs=(size=10pt family='Calibri' ) tickvalueattrs=(size=8pt)
linearopts=(viewmin=0.2 viewmax=1 tickvaluelist=(0 .2 .4 .6 .8 1.0));
%let StepOpts = lineattrs=(thickness=2.0);


%let GraphOpts = DataContrastColors=(cornflowerblue moccasin darkblue darkred)
DataColors=(cornflowerblue moccasin darkblue darkred);

%let xOptions = label="Time(in days)" offsetmin=.05 linearopts=(viewmax=MAXTIME tickvaluelist=XTICKVALS
tickvaluefitpolicy=XTICKVALFITPOL)labelattrs=(size=10pt family='Calibri' ) tickvalueattrs=(size=8pt);

%let LegendOpts = title="AML" location=inside across=2 autoalign=(TopRight) ;

%let censored = markerattrs=(symbol=circlefilled size=5px );
%let censorstr = "(*ESC*){Unicode '25cf'x} censored" / textattrs=GraphValueText(family=GraphUnicodeText:FontFamily color=LightSlateGray);

proc template;
delete Stat.Lifetest.Graphics.ProductLimitSurvival / store=sasuser.templat;
delete Stat.Lifetest.Graphics.ProductLimitSurvival2 / store=sasuser.templat;
%CompileSurvivalTemplates

ods graphics on;
proc lifetest data=sashelp.BMT plots=(s(cb=hw test ATRISK strata=panel));
time T * Status(0);
strata Group;
run;
ods graphics off;

I will appreciate any help

3 REPLIES 3
sbxkoenk
SAS Super FREQ

Hello,

 

I do not know by heart which part of the proc lifetest template does that, but you may find below paper interesting and inspiring. You will probably find out the answer to your question yourself by reading this paper in-depth:

 

Paper 427-2013
Creating and Customizing the Kaplan-Meier Survival Plot in PROC LIFETEST
Warren F. Kuhfeld and Ying So, SAS Institute Inc.

https://support.sas.com/resources/papers/proceedings13/427-2013.pdf

 

If you don't want to read on a Sunday 😁, look at this video:

Creating and customizing the Kaplan-Meier Survival Plot in PROC LIFETEST

https://video.sas.com/detail/video/2918155168001/creating-and-customizing-the-kaplan-meier-survival-...

 

Good luck,

Koen

 

Anita_n
Pyrite | Level 9

sorry, I have already seen these links but they couldn't help me further

Anita_n
Pyrite | Level 9

Dear all,

I finally found out that the Template used to display the panels is Stat.Lifetest.Graphics.ProductLimitSurvivalPanel. I am tring  to customise this to the way I want 

but I will need a little bit help. I wish to have a different color for each panel. In my case I have four panels. I realise if I make changes to the section if PLOTCENSORED it affects the 4 panels  but I want to define for example these colours (blue green gray red) each one colour should affect the corresponding panel,  the following features: plotband, plotatrisk, plotlegend and group title.

 

I will also wish to change the x-axis label, I can't really findout I to do that. I will appreciate any help

Here is the code:

proc template;
source Stat.Lifetest.Graphics.ProductLimitSurvivalPanel;
define statgraph Stat.Lifetest.Graphics.ProductLimitSurvivalPanel;
   dynamic nRows nColumns method xName plotAtRisk plotCensored plotCL plotHW plotEP plotBand
      plotLegend labelCL labelHW labelEP HeaderDisplay PanelNum yMin xtickVals xtickValFitPol
      maxTime _byline_ _bytitle_ _byfootnote_;
   BeginGraph;
      entrytitle  " Patients BMT";
      *if (PLOTATRISK)
         entrytitle " " / textattrs=GRAPHVALUETEXT;
      *endif;
      layout datapanel classvars=(STRATUM) / rowaxisopts=(display=(ticks tickvalues) altdisplay=(
         ticks tickvalues) linearopts=(viewmin=YMIN viewmax=1 tickvaluelist=( .2 .4 .6 .8 1.0)))
         headerlabeldisplay=HEADERDISPLAY rows=NROWS columns=NCOLUMNS columnaxisopts=(shortlabel=
         XNAME linearopts=(viewmax=MAXTIME tickvaluelist=XTICKVALS tickvaluefitpolicy=
         XTICKVALFITPOL)) cellheightmin=10 cellwidthmin=10 rowdatarange=unionall columndatarange=
         unionall panelnumber=PANELNUM start=TOPLEFT skipemptycells=TRUE order=PACKED shrinkfonts=
         TRUE;
         layout prototype;
            if (PLOTHW)
               if (PLOTEP)
                  bandplot LimitUpper=HW_UCL LimitLower=HW_LCL x=TIME / displayTail=false
                     modelname="Survival" fillattrs=GRAPHDATA1 datatransparency=.55 name="HW"
                     legendlabel=LABELHW;
                  bandplot LimitUpper=EP_UCL LimitLower=EP_LCL x=TIME / displayTail=false
                     modelname="Survival" fillattrs=GRAPHDATA2 datatransparency=.55 name="EP"
                     legendlabel=LABELEP;
               else
                  bandplot LimitUpper=HW_UCL LimitLower=HW_LCL x=TIME / displayTail=false
                     modelname="Survival" fillattrs=GRAPHCONFIDENCE name="HW" legendlabel=LABELHW;
               endif;
            else
               if (PLOTEP)
                  bandplot LimitUpper=EP_UCL LimitLower=EP_LCL x=TIME / displayTail=false
                  modelname="Survival" fillattrs=GRAPHCONFIDENCE name="EP" legendlabel=LABELEP ;
               endif;
            endif;
            if (PLOTCL)
               if (PLOTBAND)
                  bandplot LimitUpper=SDF_UCL LimitLower=SDF_LCL x=TIME / displayTail=false
                     modelname="Survival" display=(outline) outlineattrs=GRAPHPREDICTIONLIMITS
                     name="CL" legendlabel=LABELCL;
               else
                  bandplot LimitUpper=SDF_UCL LimitLower=SDF_LCL x=TIME / displayTail=false
                     modelname="Survival" fillattrs=GRAPHCONFIDENCE name="CL" legendlabel=LABELCL;
               endif;
            endif;
            stepplot x=TIME y=SURVIVAL / name="Survival" rolename=(_tip1=ATRISK _tip2=EVENT)
               tiplabel=(_tip1="Anzahl mit Risiko" _tip2="Beobachtete Ereignisse") tip=(x y _tip1
               _tip2) legendlabel="Überleben";
            if (PLOTCENSORED)
               scatterplot y=CENSORED x=TIME / tiplabel=(y="Survival Probability")
                  markerattrs=(symbol=circlefilled color=darkred size=5px ) name="Censored" legendlabel="Zensiert";
            endif;
            if (PLOTATRISK)
               scatterplot x=TATRISK y=Y2 / markercharacter=ATRISK ;
            endif;
         endlayout;
         sidebar / align=left;
            entry "Survival Probaility" / textattrs=GRAPHLABELTEXT rotate=90;
         endsidebar;
         if (PLOTLEGEND)
            sidebar / align=bottom;
               discretelegend 'Censored' 'CL' 'HW' 'EP' / across=4;
            endsidebar;
         endif;
      endlayout;
      if (_BYTITLE_)
         entrytitle _BYLINE_ / textattrs=GRAPHVALUETEXT;
      else
         if (_BYFOOTNOTE_)
            entryfootnote halign=left _BYLINE_;
         endif;
      endif;
   EndGraph;
end;
run;

ods graphics on;
proc lifetest data=sashelp.BMT plots=(s(cb=hw test ATRISK strata=panel));
time T * Status(0);
strata Group;
run;
ods graphics off;

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 984 views
  • 0 likes
  • 2 in conversation