<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to modify font size of the label of a survival summary table in KM plot in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-modify-font-size-of-the-label-of-a-survival-summary-table/m-p/903122#M356881</link>
    <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my program:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data _null_;
%let url = //support.sas.com/documentation/onlinedoc/stat/ex_code/151;
infile "http:&amp;amp;url/templft.html" device=url;

file 'macros.tmp';
retain pre 0;
input;
_infile_ = tranwrd(_infile_, '&amp;amp;amp;', '&amp;amp;');
_infile_ = tranwrd(_infile_, '&amp;amp;lt;' , '&amp;lt;');
if index(_infile_, '&amp;lt;/pre&amp;gt;') then pre = 0;
if pre then put _infile_;
if index(_infile_, '&amp;lt;pre&amp;gt;') then pre = 1;
run;

%inc 'macros.tmp' / nosource;

%ProvideSurvivalMacros

%let TitleText0	= " ";
%let TitleText1	= " ";
%let TitleText2	= " ";
%let nTitles 	= 1;
%let GraphOpts	= DesignHeight=500px;

%let yOptions	= label="Survival Probability"
				  labelattrs=(size=10pt weight=bold)
				  tickvalueattrs=(size=8pt)
				  linearopts=(viewmin=0 viewmax=1 tickvaluelist=(0 .2 .4 .6 .8 1.0));

%let xOptions	= label="Time (Months)"
				  shortlabel="Test"
				  offsetmin=.05
				  labelattrs=(size=10pt weight=bold)
				  tickvalueattrs=(size=8pt)
				  linearopts=(viewmax=MAXTIME tickvaluelist=(0 6 12 18 24) tickvaluefitpolicy=XTICKVALFITPOL);

%let InsetOpts = autoalign=(BottomLeft) border=true BackgroundColor=GraphWalls:Color Opaque=true;
%let LegendOpts = ;

%macro StmtsTop;
	referenceline y=0.5/lineattrs=(color=lightgray);
%mend;

%SurvivalSummaryTable

%CompileSurvivalTemplates

ods _all_ close;

proc format;
   invalue bmtnum 
				'Yes' = 1  
				'No' = 2;
   value   bmtfmt 
				1 = 'Yes'
				2 = 'No';
run;

data pcm_(drop=g);
   set pcm(rename=(group=g));
   Group = input(g, bmtnum.);
run;

ods graphics on;
ods html gpath="&amp;amp;outpath" image_dpi=300;
ods graphics on / reset=index border=off width=10in height=5in imagename="FigureTest" noborder outputfmt=svg;
proc lifetest data=pcm_ plots=survival(atrisk(maxlen=100)=0 to 24 by 6) method=KM;
	time T * Status(0);
	strata Group / order=internal;
	format group bmtfmt.;
run;
ods html close;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And I found that the label in the summary table is too big.&lt;/P&gt;&lt;P&gt;Does anyone know how to modify its font size? Thank you.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohnChen_TW_0-1700020289389.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/89782i7826C9258EDEE9EF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohnChen_TW_0-1700020289389.png" alt="JohnChen_TW_0-1700020289389.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried to modify the font size by adding (size=3pt) in the macro %SurvivalTable, below is the code&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%macro SurvivalTable;
   %local fmt r i t;
   %let fmt = bestd6.;
   %let r = halign = right;
   columnheaders;
      layout overlay / pad=(top=5);
         if(NSTRATA=1)
            layout gridded / columns=6 border=TRUE;
               dynamic PctMedianConfid NObs NEvent Median
                       LowerMedian UpperMedian;
               %SurvTabHeader(0)
               entry &amp;amp;r NObs;
               entry &amp;amp;r NEvent;
               entry &amp;amp;r eval(NObs-NEvent);
               entry &amp;amp;r eval(put(Median,&amp;amp;fmt));
               entry &amp;amp;r eval(put(LowerMedian,&amp;amp;fmt));
               entry &amp;amp;r eval(put(UpperMedian,&amp;amp;fmt));
            endlayout;
         else
            layout gridded / columns=7 border=TRUE;
               dynamic PctMedianConfid;
               %SurvTabHeader(1)
               %do i = 1 %to 10;
                  %let t = / textattrs=GraphData&amp;amp;i(size=3pt);
                  dynamic StrVal&amp;amp;i NObs&amp;amp;i NEvent&amp;amp;i Median&amp;amp;i
                          LowerMedian&amp;amp;i UpperMedian&amp;amp;i;
                  if (&amp;amp;i &amp;lt;= nstrata)
                     entry &amp;amp;r StrVal&amp;amp;i &amp;amp;t;
                     entry &amp;amp;r NObs&amp;amp;i &amp;amp;t;
                     entry &amp;amp;r NEvent&amp;amp;i &amp;amp;t;
                     entry &amp;amp;r eval(NObs&amp;amp;i-NEvent&amp;amp;i) &amp;amp;t;
                     entry &amp;amp;r eval(put(Median&amp;amp;i,&amp;amp;fmt)) &amp;amp;t;
                     entry &amp;amp;r eval(put(LowerMedian&amp;amp;i,&amp;amp;fmt)) &amp;amp;t;
                     entry &amp;amp;r eval(put(UpperMedian&amp;amp;i,&amp;amp;fmt)) &amp;amp;t;
                  endif;
               %end;
            endlayout;
         endif;
      endlayout;
   endcolumnheaders;
%mend;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And this is the output&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohnChen_TW_0-1700028544635.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/89783iE32892FD3771C523/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohnChen_TW_0-1700028544635.png" alt="JohnChen_TW_0-1700028544635.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;it became smaller...,but...the label is still truncated or covered..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 15 Nov 2023 06:10:50 GMT</pubDate>
    <dc:creator>JohnChen_TW</dc:creator>
    <dc:date>2023-11-15T06:10:50Z</dc:date>
    <item>
      <title>How to modify font size of the label of a survival summary table in KM plot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-modify-font-size-of-the-label-of-a-survival-summary-table/m-p/903122#M356881</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my program:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data _null_;
%let url = //support.sas.com/documentation/onlinedoc/stat/ex_code/151;
infile "http:&amp;amp;url/templft.html" device=url;

file 'macros.tmp';
retain pre 0;
input;
_infile_ = tranwrd(_infile_, '&amp;amp;amp;', '&amp;amp;');
_infile_ = tranwrd(_infile_, '&amp;amp;lt;' , '&amp;lt;');
if index(_infile_, '&amp;lt;/pre&amp;gt;') then pre = 0;
if pre then put _infile_;
if index(_infile_, '&amp;lt;pre&amp;gt;') then pre = 1;
run;

%inc 'macros.tmp' / nosource;

%ProvideSurvivalMacros

%let TitleText0	= " ";
%let TitleText1	= " ";
%let TitleText2	= " ";
%let nTitles 	= 1;
%let GraphOpts	= DesignHeight=500px;

%let yOptions	= label="Survival Probability"
				  labelattrs=(size=10pt weight=bold)
				  tickvalueattrs=(size=8pt)
				  linearopts=(viewmin=0 viewmax=1 tickvaluelist=(0 .2 .4 .6 .8 1.0));

%let xOptions	= label="Time (Months)"
				  shortlabel="Test"
				  offsetmin=.05
				  labelattrs=(size=10pt weight=bold)
				  tickvalueattrs=(size=8pt)
				  linearopts=(viewmax=MAXTIME tickvaluelist=(0 6 12 18 24) tickvaluefitpolicy=XTICKVALFITPOL);

%let InsetOpts = autoalign=(BottomLeft) border=true BackgroundColor=GraphWalls:Color Opaque=true;
%let LegendOpts = ;

%macro StmtsTop;
	referenceline y=0.5/lineattrs=(color=lightgray);
%mend;

%SurvivalSummaryTable

%CompileSurvivalTemplates

ods _all_ close;

proc format;
   invalue bmtnum 
				'Yes' = 1  
				'No' = 2;
   value   bmtfmt 
				1 = 'Yes'
				2 = 'No';
run;

data pcm_(drop=g);
   set pcm(rename=(group=g));
   Group = input(g, bmtnum.);
run;

ods graphics on;
ods html gpath="&amp;amp;outpath" image_dpi=300;
ods graphics on / reset=index border=off width=10in height=5in imagename="FigureTest" noborder outputfmt=svg;
proc lifetest data=pcm_ plots=survival(atrisk(maxlen=100)=0 to 24 by 6) method=KM;
	time T * Status(0);
	strata Group / order=internal;
	format group bmtfmt.;
run;
ods html close;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And I found that the label in the summary table is too big.&lt;/P&gt;&lt;P&gt;Does anyone know how to modify its font size? Thank you.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohnChen_TW_0-1700020289389.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/89782i7826C9258EDEE9EF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohnChen_TW_0-1700020289389.png" alt="JohnChen_TW_0-1700020289389.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried to modify the font size by adding (size=3pt) in the macro %SurvivalTable, below is the code&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%macro SurvivalTable;
   %local fmt r i t;
   %let fmt = bestd6.;
   %let r = halign = right;
   columnheaders;
      layout overlay / pad=(top=5);
         if(NSTRATA=1)
            layout gridded / columns=6 border=TRUE;
               dynamic PctMedianConfid NObs NEvent Median
                       LowerMedian UpperMedian;
               %SurvTabHeader(0)
               entry &amp;amp;r NObs;
               entry &amp;amp;r NEvent;
               entry &amp;amp;r eval(NObs-NEvent);
               entry &amp;amp;r eval(put(Median,&amp;amp;fmt));
               entry &amp;amp;r eval(put(LowerMedian,&amp;amp;fmt));
               entry &amp;amp;r eval(put(UpperMedian,&amp;amp;fmt));
            endlayout;
         else
            layout gridded / columns=7 border=TRUE;
               dynamic PctMedianConfid;
               %SurvTabHeader(1)
               %do i = 1 %to 10;
                  %let t = / textattrs=GraphData&amp;amp;i(size=3pt);
                  dynamic StrVal&amp;amp;i NObs&amp;amp;i NEvent&amp;amp;i Median&amp;amp;i
                          LowerMedian&amp;amp;i UpperMedian&amp;amp;i;
                  if (&amp;amp;i &amp;lt;= nstrata)
                     entry &amp;amp;r StrVal&amp;amp;i &amp;amp;t;
                     entry &amp;amp;r NObs&amp;amp;i &amp;amp;t;
                     entry &amp;amp;r NEvent&amp;amp;i &amp;amp;t;
                     entry &amp;amp;r eval(NObs&amp;amp;i-NEvent&amp;amp;i) &amp;amp;t;
                     entry &amp;amp;r eval(put(Median&amp;amp;i,&amp;amp;fmt)) &amp;amp;t;
                     entry &amp;amp;r eval(put(LowerMedian&amp;amp;i,&amp;amp;fmt)) &amp;amp;t;
                     entry &amp;amp;r eval(put(UpperMedian&amp;amp;i,&amp;amp;fmt)) &amp;amp;t;
                  endif;
               %end;
            endlayout;
         endif;
      endlayout;
   endcolumnheaders;
%mend;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And this is the output&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohnChen_TW_0-1700028544635.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/89783iE32892FD3771C523/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohnChen_TW_0-1700028544635.png" alt="JohnChen_TW_0-1700028544635.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;it became smaller...,but...the label is still truncated or covered..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2023 06:10:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-modify-font-size-of-the-label-of-a-survival-summary-table/m-p/903122#M356881</guid>
      <dc:creator>JohnChen_TW</dc:creator>
      <dc:date>2023-11-15T06:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to modify font size of the label of a survival summary table in KM plot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-modify-font-size-of-the-label-of-a-survival-summary-table/m-p/903491#M356991</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/118383"&gt;@JohnChen_TW&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can reproduce the issue on my workstation. It seems to be limited to the SVG output format, maybe due to a bug. With the more common formats &lt;FONT face="courier new,courier"&gt;outputfmt=&lt;STRONG&gt;png&lt;/STRONG&gt;&lt;/FONT&gt; or&amp;nbsp;&lt;FONT face="courier new,courier"&gt;outputfmt=&lt;STRONG&gt;jpg&lt;/STRONG&gt;&lt;/FONT&gt; I see no problem, so switching to one of those might be the easiest solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you must produce SVG output, a workaround would be to edit the SVG file (which is just a text file)&lt;FONT face="helvetica"&gt;:&lt;/FONT&gt; The labels "Yes" and "No" also occur in the at-risk table and their size is acceptable there. Indeed, the parameter &lt;FONT face="courier new,courier"&gt;textLength&lt;/FONT&gt;&amp;nbsp;for those occurrences is specified as 21.0 for "Yes" and 16.0 for "No" in the SVG file, whereas the corresponding values for the event table are too large: 48.0 and 46.0 (after your font size reduction: 28.0 and 27.0), respectively, which appears to be the reason for the truncated display. Changing these values manually to&amp;nbsp;21.0 and 16.0, resp., resolves the issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In principle, this modification could be automated by reading the SVG file as a text file in a DATA step, searching for the two strings in question (written as hexadecimal ASCII codes: &lt;FONT face="courier new,courier"&gt;&amp;amp;#x000059;&amp;amp;#x000065;&amp;amp;#x000073;&lt;/FONT&gt; for "Yes" and&amp;nbsp;&lt;FONT face="courier new,courier"&gt;&amp;amp;#x00004E;&amp;amp;#x00006F;&lt;/FONT&gt; for "No"), determining the appropriate&amp;nbsp;&lt;FONT face="courier new,courier"&gt;textLength&lt;/FONT&gt; values and writing the file back with the modified values. Obviously, this would be quite awkward and not ideal for production level code.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Nov 2023 14:15:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-modify-font-size-of-the-label-of-a-survival-summary-table/m-p/903491#M356991</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2023-11-16T14:15:30Z</dc:date>
    </item>
  </channel>
</rss>

