<?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, y2axis and legend in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-y2axis-and-legend/m-p/230919#M8366</link>
    <description>&lt;P&gt;When the plot has a GROUP role, the legend contains the unique values of the group variable (like Male and Female for variable Sex). The LEGENDLABEL is ignored. &amp;nbsp;So, to get what you want, you can format the values from the variable to the strings you&amp;nbsp;want to see in the legend. &amp;nbsp;Or, you can add a separate inset indicating which variables are being plotted on each axis.&lt;/P&gt;</description>
    <pubDate>Wed, 21 Oct 2015 12:56:48 GMT</pubDate>
    <dc:creator>Jay54</dc:creator>
    <dc:date>2015-10-21T12:56:48Z</dc:date>
    <item>
      <title>PROC SGPLOT, y2axis and legend</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-y2axis-and-legend/m-p/230778#M8351</link>
      <description>&lt;P&gt;Can I somehow modify the legend of the line graph (sgplot) to add information that one of the series has been drawn on the right axis?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data have;&lt;BR /&gt;&amp;nbsp;input year x1 x2;&lt;BR /&gt;&amp;nbsp;datalines;&lt;BR /&gt;&amp;nbsp;2000&amp;nbsp;10 &amp;nbsp;200&lt;BR /&gt;&amp;nbsp;2001&amp;nbsp;15 &amp;nbsp;190&lt;BR /&gt;&amp;nbsp;2002&amp;nbsp;12&amp;nbsp;210&lt;BR /&gt;&amp;nbsp;2003&amp;nbsp;12&amp;nbsp;220&lt;BR /&gt;&amp;nbsp;2004&amp;nbsp;10&amp;nbsp;210&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;proc sgplot data=have;&lt;BR /&gt;&amp;nbsp;series x=year y=x1;&lt;BR /&gt;&amp;nbsp;series x=year y=x2/y2axis;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now, in the legend, I would like to add info that x2 is measured on the RHS, for example "x2 (RHS)". Can I do it without labelling the variable in the original dataset?&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2015 15:51:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-y2axis-and-legend/m-p/230778#M8351</guid>
      <dc:creator>chris2377</dc:creator>
      <dc:date>2015-10-20T15:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT, y2axis and legend</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-y2axis-and-legend/m-p/230789#M8353</link>
      <description>&lt;P&gt;Sure. &amp;nbsp;Put whatever text you want. &amp;nbsp;If you want only one item, use the Keylegend statement shown.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sgplot data=have;&lt;BR /&gt; series x=year y=x1 / name='a' legendlabel='X1 - On Left Hand Y axis';&lt;BR /&gt; series x=year y=x2/y2axis name='b' legendlabel='X2 - On Right Hand Y axis';&lt;BR /&gt; keylegend 'b';&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or, you can add an INSET.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2015 17:06:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-y2axis-and-legend/m-p/230789#M8353</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2015-10-20T17:06:03Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT, y2axis and legend</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-y2axis-and-legend/m-p/230876#M8359</link>
      <description>&lt;P&gt;Thanks a lot. Easier than I expected. I somehow missed this option when I was looking at the syntax detail.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One additional question - can I do something similar with grouped graphs?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data have;&lt;BR /&gt;&amp;nbsp;input year group_name $1. x1 x2;&lt;BR /&gt;&amp;nbsp;datalines;&lt;BR /&gt;&amp;nbsp;2000 A&amp;nbsp;10 200&lt;BR /&gt;&amp;nbsp;2001 A&amp;nbsp;15 190&lt;BR /&gt;&amp;nbsp;2002 A&amp;nbsp;12 210&lt;BR /&gt;&amp;nbsp;2003 A&amp;nbsp;12 220&lt;BR /&gt;&amp;nbsp;2004 A&amp;nbsp;10 210&lt;BR /&gt;&amp;nbsp;2000 B&amp;nbsp;20 200&lt;BR /&gt;&amp;nbsp;2001 B&amp;nbsp;30 300&lt;BR /&gt;&amp;nbsp;2002 B&amp;nbsp;24 310&lt;BR /&gt;&amp;nbsp;2003 B&amp;nbsp;24 320&lt;BR /&gt;&amp;nbsp;2004 B&amp;nbsp;20 330&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;On the graph there would be 4 series - two on the left axis and two on the right. I would like the legend to be something like that:&lt;BR /&gt;A - x1&lt;BR /&gt;A - x2 (RHS)&lt;BR /&gt;B - x1&lt;BR /&gt;B - x2(RHS)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2015 07:43:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-y2axis-and-legend/m-p/230876#M8359</guid>
      <dc:creator>chris2377</dc:creator>
      <dc:date>2015-10-21T07:43:19Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT, y2axis and legend</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-y2axis-and-legend/m-p/230919#M8366</link>
      <description>&lt;P&gt;When the plot has a GROUP role, the legend contains the unique values of the group variable (like Male and Female for variable Sex). The LEGENDLABEL is ignored. &amp;nbsp;So, to get what you want, you can format the values from the variable to the strings you&amp;nbsp;want to see in the legend. &amp;nbsp;Or, you can add a separate inset indicating which variables are being plotted on each axis.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2015 12:56:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-y2axis-and-legend/m-p/230919#M8366</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2015-10-21T12:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT, y2axis and legend</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-y2axis-and-legend/m-p/231361#M8389</link>
      <description>Thanks</description>
      <pubDate>Fri, 23 Oct 2015 14:53:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-y2axis-and-legend/m-p/231361#M8389</guid>
      <dc:creator>chris2377</dc:creator>
      <dc:date>2015-10-23T14:53:24Z</dc:date>
    </item>
  </channel>
</rss>

