Dear I am using the following graph template to produce a km plot.
I am getting graph but in the bottom table is truncated. The bottom table (graph attached) in the shows only four treatemnts instead 6 as seen in legend. Please help where i need to modify in the template. Thank you
proc template;
define statgraph KM;
begingraph;
dynamic _prttlout _prttlin _prfntout _prfntin;
if (_prttlout= 1) %do _cnt = 1 %to &_ttlout0; entrytitle "&&_ttlout&_cnt"; %end; endif;
if (_prttlin = 1) %do _cnt = 1 %to &_ttlin0; entrytitle textattrs=(style=normal size=11) "&&_ttlin&_cnt"; %end; endif;
if (_prfntin = 1) %do _cnt = 1 %to &_fttin0; entryfootnote halign=left "&&_fntin&_cnt"; %end; endif;
if (_prfntout= 1) %do _cnt = 1 %to &_fttout0; entryfootnote halign=left "&&_fntout&_cnt"; %end; endif;
layout lattice / columns=1 rowgutter=8 rowweights=(&_rowwght);
%if "&stats1" eq "Y" %then %do;
layout gridded / columns=&cnt border=false;
entry " "; %do i = 1 %to &n_grp; entry "&&grp&i"; %end;
%if "&_r1" eq "Y" %then %do; entry halign=right "Number of Subjects"; %do i=1 %to &n_grp; entry "&&total&i"; %end; %end;
%if "&_r2" eq "Y" %then %do; entry halign=right "Number of Events"; %do i=1 %to &n_grp; entry "&&failed&i"; %end; %end;
%if "&_r3" eq "Y" %then %do; entry halign=right "% of Events (95% CI)"; %do i=1 %to &n_grp; entry "&&failpci&i"; %end; %end;
%if "&_r4" eq "Y" %then %do; entry halign=right "Survival Mean Time (SDE)"; %do i=1 %to &n_grp; entry "&&meansde&i"; %end; %end;
%if "&_r5" eq "Y" %then %do; entry halign=right "Median Survival (95% CI)"; %do i=1 %to &n_grp; entry "&&medianci&i"; %end; %end;
endlayout;
%end;
layout overlay / yaxisopts=(griddisplay=on offsetmin=0 linearopts=(viewmin=&_yvalmin viewmax=&_yvalmax tickvaluelist=(&_yvallst)
/* minorticks=true*/) %if %sysevalf(%superq(y_label)^=,boolean) %then label="&y_label";)
xaxisopts=(griddisplay=on offsetmin=0 linearopts=(viewmin=&_timemin viewmax=&_timemax tickvaluelist=(&x_order)
/*minorticks=true*/) %if %sysevalf(%superq(x_label)^=,boolean) %then label="&x_label";);
%if "&display_label" ne "-1" %then %do;
scatterplot x=lbltime y=y_&plot / group=&group_var datalabel=lbl_&plot;
%end;
%if "&bb_style" eq "BAND" or "&bb_style" eq "BOTH" %then %do;
bandplot x=time LimitUpper=L&bb_type._&plot LimitLower=U&bb_type._&plot / group=&group_var datatransparency=0.7 modelName="s";
%end;
%if "&bb_style" eq "BAR" or "&bb_style" eq "BOTH" %then %do;
scatterplot x=tabtime y=B_&plot / group=&group_var yerrorlower=B_L&bb_type._&plot yerrorupper=B_U&bb_type._&plot groupdisplay=cluster clusterwidth=0.15;
%end;
stepplot x=time y=&plot / group=&group_var name='s' primary=true;
%if "&_censor_yn" eq "Y" %then %do;
scatterplot x=time y=censor_&plot / group=&group_var markercharacter=censor_flag markercharacterattrs=(size=11);
%end;
layout gridded / autoalign=&_autoalign border=false;
/* %if "&_censor_yn" eq "Y" %then %do; entry halign=center "&_censor_sb2 Censored"; %end;*/
%if %sysevalf(%superq(display_pvalue)=Y,boolean) %then %do; entry halign=center "Log-Rank p=&log_rank_p"; %end;
%if %sysevalf(%superq(n_grp)>1,boolean) %then %do; discretelegend 's' / valueattrs=(size=8) border=off location=inside across=1; %end;
endlayout;
endlayout;
%if "&tab1var" ne "NONE" %then %do;
layout overlay / walldisplay=NONE xaxisopts=(display=none
linearopts=(viewmin=&_timemin viewmax=&_timemax tickvaluelist=(&x_order))) border=false ;
entry halign=left "&tab1ttl" / location=outside valign=top textattrs=(weight=normal);
axistable x=tabtime value=&tab1var / class=&group_var display=(label) valueattrs=(size=9pt);
endlayout;
%end;
%if "&tab2var" ne "NONE" %then %do;
layout overlay / walldisplay=NONE xaxisopts=(display=none
linearopts=(viewmin=&_timemin viewmax=&_timemax tickvaluelist=(&x_order))) border=false ;
entry halign=left "&tab2ttl" / location=outside valign=top textattrs=(weight=bold);
axistable x=tabtime value=&tab2var / class=&group_var display=(label) valueattrs=(size=6pt);
endlayout;
%end;
endlayout;
endgraph;
end;
run;
%*** customized style changing size and stype of title/footnote font.;
proc template;
define style _myrtf_;
parent = &_style ;
style fonts /
'TitleFont2' = ("Times New Roman, Times, Arial",11pt,normal)
'TitleFont' = ("Times New Roman, Times, Arial",11pt,normal)
'StrongFont' = ("Times New Roman, Times, Arial",10pt,bold)
'EmphasisFont' = ("Times New Roman, Times, Arial",10pt,italic)
'FixedEmphasisFont' = ("<monospace>, Courier",9pt,italic)
'FixedStrongFont' = ("<monospace>, Courier",9pt,bold)
'FixedHeadingFont' = ("<monospace>, Courier",9pt,bold)
'BatchFixedFont' = ("SAS Monospace, <monospace>, Courier",7pt)
'FixedFont' = ("<monospace>, Courier",9pt)
'headingEmphasisFont' = ("<serif>, Times New Roman, Times",11pt,bold italic)
'headingFont' = ("<serif>, Times New Roman, Times",11pt,bold)
'docFont' = ("<serif>, Times New Roman, Times",10pt);
end;
run;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.