<?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: proc sgplot : splitting legend items in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-splitting-legend-items/m-p/931966#M24701</link>
    <description>&lt;P&gt;You don't have the split in PROC FORMAT correct.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You want&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods escapechar='^' ;
proc format;
    value age 11-13="Group^{newline}Young"
              14-16="Group^{newline}Old";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;so this works in PROC PRINT and PROC REPORT and similar types of output.&amp;nbsp; Stealing from&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Subscript-in-axis-label-for-SGPLOT-showing-as-boxes/m-p/823505/highlight/true#M325158" target="_self"&gt;here&lt;/A&gt;, I can even get escape characters to work in SGPLOT in axis labels and titles and footnotes using the (*ESC*) delimiter, but I can't get it to work in SGPLOT legends.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=class;
    vbarbasic sex / response=height stat=mean group=age;
    format age age.;
    keylegend / position=right;
    yaxis label="Height(*ESC*){unicode '000A'x}Inches";
run;    
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: I can get other unicode characters to work where the line break is supposed to be. For example, if instead of the line break, I want a "greater than or equal to sign" (Unicode 2265) even though it makes no sense in this context, this code works inside of legends. It just doesn't seem to work for line breaks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
    value age 11-13="Group(*ESC*){unicode '2265'x}Young"
              14-16="Group(*ESC*){unicode '2265'x}Old";
run;&lt;/CODE&gt;&lt;/PRE&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;</description>
    <pubDate>Wed, 12 Jun 2024 18:22:27 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2024-06-12T18:22:27Z</dc:date>
    <item>
      <title>proc sgplot : splitting legend items</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-splitting-legend-items/m-p/931933#M24700</link>
      <description>&lt;P&gt;Hi, Me again!&lt;/P&gt;
&lt;P&gt;Correct me if I missed an option.&lt;/P&gt;
&lt;P&gt;Create a line break in legend items is not possible.&lt;/P&gt;
&lt;P&gt;The solution with escape character working in an axis label won't work in legend items.&lt;/P&gt;
&lt;P&gt;There is no fitpolicy option when it comes to the keylegend statement or legenditem statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods escapechar='^' ;
proc format;
    value age 11-13='Group^Young'
              14-16='Group^Old';
run;

proc sort data=sashelp.class out=class;
    by sex age;
run;    

proc sgplot data=class;
    vbarbasic sex / response=height stat=mean group=age;
    format age age.;
    keylegend / position=right;
run;    

proc sgplot data=class;
    vbarbasic sex / response=height stat=mean group=age;
    format age age.;

    legenditem type=fill name='1'
              / label='Group^Young';
    legenditem type=fill name='2'
              / label='Group^Old';
    keylegend '1' '2'/ position=right;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Jun 2024 17:09:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-splitting-legend-items/m-p/931933#M24700</guid>
      <dc:creator>xxformat_com</dc:creator>
      <dc:date>2024-06-12T17:09:18Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgplot : splitting legend items</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-splitting-legend-items/m-p/931966#M24701</link>
      <description>&lt;P&gt;You don't have the split in PROC FORMAT correct.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You want&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods escapechar='^' ;
proc format;
    value age 11-13="Group^{newline}Young"
              14-16="Group^{newline}Old";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;so this works in PROC PRINT and PROC REPORT and similar types of output.&amp;nbsp; Stealing from&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Subscript-in-axis-label-for-SGPLOT-showing-as-boxes/m-p/823505/highlight/true#M325158" target="_self"&gt;here&lt;/A&gt;, I can even get escape characters to work in SGPLOT in axis labels and titles and footnotes using the (*ESC*) delimiter, but I can't get it to work in SGPLOT legends.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=class;
    vbarbasic sex / response=height stat=mean group=age;
    format age age.;
    keylegend / position=right;
    yaxis label="Height(*ESC*){unicode '000A'x}Inches";
run;    
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: I can get other unicode characters to work where the line break is supposed to be. For example, if instead of the line break, I want a "greater than or equal to sign" (Unicode 2265) even though it makes no sense in this context, this code works inside of legends. It just doesn't seem to work for line breaks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
    value age 11-13="Group(*ESC*){unicode '2265'x}Young"
              14-16="Group(*ESC*){unicode '2265'x}Old";
run;&lt;/CODE&gt;&lt;/PRE&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;</description>
      <pubDate>Wed, 12 Jun 2024 18:22:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-splitting-legend-items/m-p/931966#M24701</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-06-12T18:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgplot : splitting legend items</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-splitting-legend-items/m-p/931971#M24702</link>
      <description>&lt;P&gt;Maybe a bit of a kludge&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sgplot data=class ;
    vbarbasic sex / response=height stat=mean group=age;
    format age age.;

    legenditem type=fill name='1'
              / label='Group' fillattrs=graphdata1;
    legenditem type=text name='a'
              / label='Young';
    legenditem type=Fill name='2'
              / label='Group' fillattrs=graphdata2;
    legenditem type=text name='b'
              / label='Old';
    keylegend  '1' 'a' '2' 'b'/ position=right;
run;
&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Jun 2024 17:50:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-splitting-legend-items/m-p/931971#M24702</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-06-12T17:50:57Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgplot : splitting legend items</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-splitting-legend-items/m-p/931973#M24703</link>
      <description>&lt;P&gt;Correct -- there is not currently not an option to split legend labels. That being said, there are a couple of things to clear up for you regarding ODS ESCAPECHAR usage in ODS GRAPHICS.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Specifying the ODS escapement in the string by itself has no effect -- you also have to specify a function. For ODS GRAPHICS, we support only the &lt;STRONG&gt;unicode&lt;/STRONG&gt; function in text strings. For example, "alpha=^{unicode '03b1'x}". In the INSET statement and in annotation, we also support the sup and sub functions( "R^{sup '2'}"). For sup/sub support in the regular text strings, you need to use the sup/sub Unicode values.&lt;/LI&gt;
&lt;LI&gt;When using ods escapement in PROC FORMAT, you &lt;STRONG&gt;mus&lt;/STRONG&gt;t use the default ODS ESCAPE sequence, which is (*ESC*). This sequence will work anywhere -- ODS ESCAPECHAR is just a way to define one character to do the same thing.&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Wed, 12 Jun 2024 17:57:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-splitting-legend-items/m-p/931973#M24703</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2024-06-12T17:57:49Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgplot : splitting legend items</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-splitting-legend-items/m-p/932086#M24705</link>
      <description>Thank you Dan</description>
      <pubDate>Thu, 13 Jun 2024 05:41:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-splitting-legend-items/m-p/932086#M24705</guid>
      <dc:creator>xxformat_com</dc:creator>
      <dc:date>2024-06-13T05:41:41Z</dc:date>
    </item>
  </channel>
</rss>

