<?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 Re: ODS PDF entry truncation in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/ODS-PDF-entry-truncation/m-p/591810#M18913</link>
    <description>&lt;P&gt;So I had a little play around with this again, if I replace&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt; &lt;SPAN class="token keyword"&gt;entry&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;r StrVal&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;i &lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;t&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;with&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt; &lt;SPAN class="token keyword"&gt;entry&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;r "&amp;amp;&amp;amp;&amp;amp;trt&amp;amp;i" &lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;t&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;with the treatment label defined outside the template then the label is printed correctly.&amp;nbsp; So it seems to be related to some kind of style applied to the StrVal within&amp;nbsp;&lt;CODE&gt;Stat.Graphics.ProductLimitSurvival&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;Any idea how I may get at this StrVal variable?&lt;/P&gt;</description>
    <pubDate>Thu, 26 Sep 2019 10:42:23 GMT</pubDate>
    <dc:creator>SwissC</dc:creator>
    <dc:date>2019-09-26T10:42:23Z</dc:date>
    <item>
      <title>ODS PDF entry truncation</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/ODS-PDF-entry-truncation/m-p/591434#M18912</link>
      <description>&lt;P&gt;I am producing a PDF graph that contains some entry statements.&amp;nbsp; However in PDF they seem to get tructation.&amp;nbsp; The graph prints perfectly using ODS rtf.&amp;nbsp; But if you look at the drug names in the medians block you can see they are a. truncated and b. the font seems weird (not the same size). Strangely if I use the text select tool in Acrobat viewer I can select and copy&amp;amp;paste the full text, so it is like it is hidden behind something.&amp;nbsp; Am I missing something?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Annotation 2019-09-25 110317.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/32728iC7829C180815443C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Annotation 2019-09-25 110317.png" alt="Annotation 2019-09-25 110317.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code is attached in 3 parts (the 2 macros and the program).&amp;nbsp; I cannot show any data but the dataset consists of&lt;/P&gt;&lt;P&gt;usubjid, months, cnsr, trt01pn.&amp;nbsp; Trt01pn has values 2 &amp;amp; 3 formatted to "ABCDEFG + abcdefghijkl" and ""abcdefghijkl" respectively.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using SAS 9.4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro mkmtemplate;

   %global atriskopts bandopts censored censorstr classopts
           graphopts groups insetopts legendopts ntitles stepopts tiplabel
           tips titletext0 titletext1 titletext2 xoptions yoptions srvtble _colr;

   %let yOptions   = label=&amp;amp;_ylabel shortlabel="Survival" LABELFITPOLICY=splitalways LABELSPLITCHAR="#" labelsplitjustify=bottom  
                     linearopts=(viewmin=0 viewmax=1
                                 tickvaluelist=(0 0.2 0.4 0.6 0.8 1) tickvalueFormat= 3.1 );

   %let xOptions   = shortlabel=XNAME offsetmin=.05 linearopts=(viewmax=&amp;amp;_maxtime tickvaluelist=XTICKVALS tickvaluefitpolicy=XTICKVALFITPOL);

   %let Tips       = rolename=(_tip1= ATRISK _tip2=EVENT)
                     tiplabel=(_tip1="Number at Risk" _tip2="Observed Events")
                     tip=(x y _tip1 _tip2);
                     
   %let TipLabel   = tiplabel=(y="Survival Probability");
   %let StepOpts   = ;

   %let Groups     = group=STRATUM index=STRATUMNUM;

   %let BandOpts   = &amp;amp;groups modelname="Survival";

   %let InsetOpts  = autoalign=(TOPRIGHT BOTTOMLEFT BOTTOMRIGHT TOP BOTTOM RIGHT)
                     border=false BackgroundColor=GraphWalls:Color Opaque=true;

   %let LegendOpts = title=&amp;amp;_legtitl location=inside valueattrs=(size=9pt) &amp;amp;InsetOpts;

   %let AtRiskOpts = valueattrs=(size=9pt)  display=(label) ;
   %let ClassOpts  = class=CLASSATRISK colorgroup=CLASSATRISK display=(label);

   %let Censored   = markerattrs=(symbol=circlefilled size=6);
   %let CensorStr  = "Censored";

   %let GraphOpts  = ;

   %LET srvtble    = YES;


   %macro CompileSurvivalTemplates;
      %local outside;
      proc template;
            define statgraph
               Stat.Lifetest.Graphics.ProductLimitSurvival2;
               dynamic NStrata xName plotAtRisk
                  %if %nrbquote(&amp;amp;censored) ne %then plotCensored;
                  plotCL plotHW plotEP labelCL labelHW labelEP maxTime xtickVals
                  xtickValFitPol rowWeights method StratumID classAtRisk 
                  plotTest GroupName Transparency SecondTitle TestName  ;
               BeginGraph %if %nrbquote(&amp;amp;graphopts) ne %then / border=false pad=0 &amp;amp;graphopts;;


                           
                  legenditem  type=marker name="CenLgd" / label=&amp;amp;CensorStr lineattrs=(color=black) markerattrs=(symbol=circlefilled color=black size=6);

        	  layout lattice / rows=2 rowweights=ROWWEIGHTS columndatarange=union rowgutter=10;
         	    cell;
                  layout overlay / xaxisopts=(&amp;amp;xoptions) yaxisopts=(&amp;amp;yoptions);
				      stepplot y=eval(SURVIVAL)  x=TIME / &amp;amp;groups name="Survival" &amp;amp;tips &amp;amp;stepopts;
				      scatterplot y=eval(CENSORED) x=TIME / &amp;amp;groups &amp;amp;tiplabel &amp;amp;censored name="Censored" legendlabel="Censored";
				      MERGEDLEGEND "Survival" "Censored" / across=1 &amp;amp;legendopts ADDITIONALNAMES=("CenLgd");
				      %if %nrbquote(&amp;amp;srvtble) ne %then %do;
				         %SurvivalTable;
				      %end;
                  endlayout;
                endcell;
         		cell;           
            	  layout overlay / walldisplay=none xaxisopts=(display=none &amp;amp;xOptions);
               	    axistable x=TATRISK value=ATRISK / &amp;amp;atriskopts &amp;amp;classopts;;
            	  endlayout;
         		endcell;
      		  endlayout;

               EndGraph;
            end; 
                        
            quit;
      run;
   %mend CompileSurvivalTemplates;



   %macro SurvivalTable;
      %local fmt r i t;
      %let fmt = &amp;amp;_fmt;
      %let r = halign = right;
               layout gridded / columns=1 rows=4 &amp;amp;InsetOpts ;
                     entry halign=center "Median &amp;amp;kmtype in months (95% CI)" / textattrs=GraphData;
               layout gridded / columns=4 &amp;amp;InsetOpts;
                  dynamic PctMedianConfid;
                  %do i = 1 %to 2;
                     %let t = / textattrs=GraphData&amp;amp;i (family="Courier New" size=9pt) ;
                     dynamic StrVal&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;
                        if(Median&amp;amp;i ne .)       entry &amp;amp;r eval(put(Median&amp;amp;i,&amp;amp;fmt)) &amp;amp;t;       else entry &amp;amp;r "N.E" &amp;amp;t; endif;
                        if(LowerMedian&amp;amp;i ne .)  entry &amp;amp;r "(" eval(put(LowerMedian&amp;amp;i,&amp;amp;fmt)) "," &amp;amp;t;  else entry &amp;amp;r "N.E" &amp;amp;t; endif; 
                        if(UpperMedian&amp;amp;i ne .)  entry &amp;amp;r eval(put(UpperMedian&amp;amp;i,&amp;amp;fmt))")" &amp;amp;t;  else entry &amp;amp;r "N.E" &amp;amp;t; endif;
                     endif;
                  %end;                             
               endlayout;          
               endlayout;
   %mend SurvivalTable;


%CompileSurvivalTemplates;

%mend mkmtemplate;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%MACRO mkmplot (_inds=,
                _time=,
                _cen =,
                _strat=,
                _timetick=,
                _maxtime=,
                _ylabel="Probability of Survival (%)",
                _legtitl=GROUPNAME,
                _alphaqt=0.05,
                _fmt=bestd6.,
                _kmtime=,
                _opts=none,
                _opts2=none,
                _orint=portrait,
                _colour=no,
                _showtxt=1,
                _dev=svg
                );


*******************************************************************************************************/;
*****  Find graph limits and by var label and number of strata                                    *****/;
*******************************************************************************************************/;
PROC CONTENTS data=&amp;amp;_inds out=datatest noprint;RUN;
%LET _strata=;
%LET _xtlbl= - &amp;amp;_strat;
DATA _null_;
  SET datatest (where=(upcase(name)=upcase(compress("&amp;amp;_strat","_", "kna")))); 
  call symput('_strata', "&amp;amp;_strat");
  call symput('_xtlbl', "");
RUN;
PROC DATASETS lib=work memtype=data nolist;DELETE datatest;RUN;QUIT;


PROC SQL noprint;
  %IF %nrbquote(&amp;amp;_maxtime) ne %THEN %DO;
  SELECT distinct ceil(&amp;amp;_maxtime./&amp;amp;_timetick.)* &amp;amp;_timetick.
  INTO :__maxmon
  FROM &amp;amp;_inds;
  %END;

  %ELSE %DO;
  SELECT distinct ceil(max(&amp;amp;_time)/&amp;amp;_timetick.)* &amp;amp;_timetick.
  INTO :__maxmon
  FROM &amp;amp;_inds;
  %END;
QUIT;


*******************************************************************************************************/;
*****  Run template and make any required updateds                                                *****/;
*******************************************************************************************************/;

%mkmtemplate;

/* make changes here */
%IF %SYSMACEXIST(&amp;amp;_opts) %THEN %DO;
%&amp;amp;_opts;

   
%END;

  *** =======================================================================;
  ** This will allow us to define a new temporary template;
  ods path(prepend) work.templat(update);
  ods path show;
%CompileSurvivalTemplates;


*******************************************************************************************************/;
*****  Create plot                                                                                *****/;
*******************************************************************************************************/;

ods listing close;
ods noptitle;

%IF &amp;amp;_orint=portrait %THEN %DO;
  ODS graphics on / border=off height=10cm width=19cm;
  GOPTIONS ymax=10cm xmax=19cm;   
  OPTIONS orientation=portrait papersize='ISO A4' nodate nonumber nobyline ; 
%END;
%ELSE %DO;
  ODS graphics on / border=off height=12cm width=25cm ;
  GOPTIONS xmax=25cm ymax=12cm;
  OPTIONS orientation=landscape papersize='ISO A4' nodate nonumber nobyline ;    
%END;

   ods graphics on / imagefmt=&amp;amp;_dev;
ods select SurvivalPlot;

proc lifetest data=&amp;amp;_inds PLOTS=SURVIVAL( ATRISK (atrisktickonly outside)= 0 TO &amp;amp;__maxmon BY &amp;amp;_timetick) alphaqt=&amp;amp;_alphaqt METHOD=KM CONFTYPE=LOGLOG;
   time &amp;amp;_time * &amp;amp;_cen(1);
   strata &amp;amp;_strata / order=internal test=none;
run;quit;

ods graphics off;
%MEND mkmplot;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;**----------------------------------------------------------------**;
** Report data                       
**----------------------------------------------------------------**;
  ods path(prepend) work.templat(update);
  ods path show;
PROC TEMPLATE;
define style styles.graph;
         parent=styles.rtf;
         %** important thing to notice is the protectspecialchars, which allows us to push the RTF codes through **;
         style table from table / protectspecialchars=off;
                                                
               replace body from document /
                  bottommargin = 0.00cm
                  topmargin    = 2.50cm
                  rightmargin  = 0.00cm
                  leftmargin   = 1.10cm;

               replace fonts /
                        'CellFont'             = ("Courier New",9pt)
                        'TitleFont2'           = ("arial",9pt)
                        'TitleFont'            = ("arial",9pt)
                        'StrongFont'           = ("arial",9pt)
                        'EmphasisFont'         = ("arial",9pt)
                        'FixedEmphasisFont'    = ("arial",9pt)
                        'FixedStrongFont'      = ("arial",9pt)
                        'FixedHeadingFont'     = ("arial",9pt)
                        'BatchFixedFont'       = ("arial",9pt)
                        'FixedFont'            = ("arial",9pt)
                        'headingEmphasisFont'  = ("arial",9pt)
                        'headingFont'          = ("arial",9pt)
                        'docFont'              = ("arial",9pt);

                  style GraphFonts from GraphFonts /
                        'GraphDataFont' = ("Courier New",9pt)
                        'GraphUnicodeFont' = ("Courier New",9pt)
                        'GraphValueFont' = ("Courier New",9pt)
                        'GraphLabelFont' = ("Courier New",9pt)
                        'GraphFootnoteFont' = ("Courier New",9pt)
                        'GraphTitleFont' = ("Courier New",9pt)
                        'GraphAnnoFont' = ("Courier New",9pt); 
            style GraphData1 from GraphData1 / font=("Courier New", 9pt) contrastcolor=black;;
            style GraphData2 from GraphData2 / font=("Courier New", 9pt) contrastcolor=cx808080;
            style GraphData3 from GraphData3 / LineStyle = 3;
                  end;

            quit;
      run;  

  ODS graphics on / border=off height=12cm width=25cm ;
  GOPTIONS xmax=25cm ymax=12cm;
  OPTIONS orientation=landscape papersize='ISO A4' nodate nonumber nobyline ;   
  

ods pdf dpi=300 file="..../mygraph.pdf" style=graph;

%LET kmtype=PFS;
   
%mkmplot (_inds=adtte,
          _time=months,
          _cen =cnsr,
          _strat=trt01pn,
          _timetick=3,
          _maxtime=24,
          _ylabel="Probability of PFS",
          _legtitl=" ",
          _alphaqt=0.05,
          _fmt=5.1,
          _kmtime=,
          _opts=none,
          _opts2=none,
          _orint=landscape
          _colour=yes
          _dev=svg
                );
                
ODS pdf close;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2019 10:43:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/ODS-PDF-entry-truncation/m-p/591434#M18912</guid>
      <dc:creator>SwissC</dc:creator>
      <dc:date>2019-09-26T10:43:19Z</dc:date>
    </item>
    <item>
      <title>Re: ODS PDF entry truncation</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/ODS-PDF-entry-truncation/m-p/591810#M18913</link>
      <description>&lt;P&gt;So I had a little play around with this again, if I replace&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt; &lt;SPAN class="token keyword"&gt;entry&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;r StrVal&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;i &lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;t&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;with&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt; &lt;SPAN class="token keyword"&gt;entry&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;r "&amp;amp;&amp;amp;&amp;amp;trt&amp;amp;i" &lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;t&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;with the treatment label defined outside the template then the label is printed correctly.&amp;nbsp; So it seems to be related to some kind of style applied to the StrVal within&amp;nbsp;&lt;CODE&gt;Stat.Graphics.ProductLimitSurvival&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;Any idea how I may get at this StrVal variable?&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2019 10:42:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/ODS-PDF-entry-truncation/m-p/591810#M18913</guid>
      <dc:creator>SwissC</dc:creator>
      <dc:date>2019-09-26T10:42:23Z</dc:date>
    </item>
  </channel>
</rss>

