<?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: SGPLOT, group and variable for the labels in the legend in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-group-and-variable-for-the-labels-in-the-legend/m-p/396898#M13595</link>
    <description>&lt;P&gt;Do you mean something like this?&lt;/P&gt;
&lt;P&gt;Make and Origin may not have similar number of levels. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;May be better to just label the Origin on each marker.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc summary data=sashelp.cars (obs=20) nway;&lt;BR /&gt;class make;&lt;BR /&gt;var EngineSize Length;&lt;BR /&gt;id origin;&lt;BR /&gt;output out=plotds mean=avg_eng avg_len ;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;ods graphics / reset attrpriority=none;&lt;BR /&gt;proc sgplot data=plotds nocycleattrs;&lt;BR /&gt; scatter x=avg_eng y=avg_len / group=origin name='a' markerattrs=(size=10) ;&lt;BR /&gt; scatter x=avg_eng y=avg_len / group=make datalabel=make markerattrs=(size=10) ;&lt;BR /&gt; keylegend 'a';&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Mon, 18 Sep 2017 17:55:50 GMT</pubDate>
    <dc:creator>Jay54</dc:creator>
    <dc:date>2017-09-18T17:55:50Z</dc:date>
    <item>
      <title>SGPLOT, group and variable for the labels in the legend</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-group-and-variable-for-the-labels-in-the-legend/m-p/396843#M13591</link>
      <description>&lt;P&gt;I have to plot some mean data by a group.&lt;/P&gt;&lt;P&gt;By default the names in the legend is then the names from the defined group.&lt;/P&gt;&lt;P&gt;Are the anyway you can refer to a another variable for to appear in the name in the legend. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As an axample below: I want to plot the&amp;nbsp;&lt;SPAN&gt;sashelp.cars&amp;nbsp; dataset and instead of having grouping variable MAKE&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"Acura" &amp;nbsp;"Audi"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;in the names legend I want to refer to the variable&amp;nbsp;ORIGIN&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"Asia"&amp;nbsp;"Europe"&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is that posible (sorry, not the most meanigfull example) ?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=sashelp.cars (obs=20)  nway;
class make;
var EngineSize Length;
id origin;
output out=plotds mean=avg_eng avg_len ;
run;


proc sgplot data=plotds;
 scatter x=avg_eng  y=avg_len / group=make   ;
run; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Sep 2017 15:36:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-group-and-variable-for-the-labels-in-the-legend/m-p/396843#M13591</guid>
      <dc:creator>Claus_Stenberg_DK</dc:creator>
      <dc:date>2017-09-18T15:36:01Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT, group and variable for the labels in the legend</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-group-and-variable-for-the-labels-in-the-legend/m-p/396848#M13592</link>
      <description>&lt;P&gt;That doesn't make a heck of a lot of sense, but you can use a format to control the display of the variables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You create the format outside of the SGPLOT and apply it to the data with a format statement.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2017 15:42:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-group-and-variable-for-the-labels-in-the-legend/m-p/396848#M13592</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-18T15:42:00Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT, group and variable for the labels in the legend</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-group-and-variable-for-the-labels-in-the-legend/m-p/396861#M13593</link>
      <description>&lt;P&gt;If you want the origin in the legend then use origin in the group statement.&lt;/P&gt;
&lt;P&gt;Or is there something else you are attempting that does not work for?&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2017 15:58:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-group-and-variable-for-the-labels-in-the-legend/m-p/396861#M13593</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-09-18T15:58:57Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT, group and variable for the labels in the legend</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-group-and-variable-for-the-labels-in-the-legend/m-p/396898#M13595</link>
      <description>&lt;P&gt;Do you mean something like this?&lt;/P&gt;
&lt;P&gt;Make and Origin may not have similar number of levels. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;May be better to just label the Origin on each marker.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc summary data=sashelp.cars (obs=20) nway;&lt;BR /&gt;class make;&lt;BR /&gt;var EngineSize Length;&lt;BR /&gt;id origin;&lt;BR /&gt;output out=plotds mean=avg_eng avg_len ;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;ods graphics / reset attrpriority=none;&lt;BR /&gt;proc sgplot data=plotds nocycleattrs;&lt;BR /&gt; scatter x=avg_eng y=avg_len / group=origin name='a' markerattrs=(size=10) ;&lt;BR /&gt; scatter x=avg_eng y=avg_len / group=make datalabel=make markerattrs=(size=10) ;&lt;BR /&gt; keylegend 'a';&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2017 17:55:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-group-and-variable-for-the-labels-in-the-legend/m-p/396898#M13595</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2017-09-18T17:55:50Z</dc:date>
    </item>
  </channel>
</rss>

