<?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 Legend with One Variable Repeated Twice in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Legend-with-One-Variable-Repeated-Twice/m-p/596350#M171692</link>
    <description>&lt;P&gt;From SAS 9.4M5, you can do something like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
do t=1 to 5000;
if t=1 then x=1;
else x=x*(1+0.1/12+0.05/sqrt(12)*rannor(1));
output;
end;
run;

proc sgplot;
series x=t y=x;
series x=t y=x/y2axis;
xaxis display=(nolabel);
yaxis display=(nolabel);
y2axis display=(nolabel) type=log;

legenditem type=line name='x1' / label='x' lineattrs=GraphData1;
legenditem type=line name='x2' / label='x (Log)' lineattrs=GraphData2;

keylegend 'x1' 'x2';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="SGPlot4.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/33130iE02500DF9AAF1270/image-size/large?v=v2&amp;amp;px=999" role="button" title="SGPlot4.png" alt="SGPlot4.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 14 Oct 2019 19:04:40 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2019-10-14T19:04:40Z</dc:date>
    <item>
      <title>SGPLOT Legend with One Variable Repeated Twice</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Legend-with-One-Variable-Repeated-Twice/m-p/596336#M171686</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SGPlot.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/33129i74325294FD6BCC5B/image-size/large?v=v2&amp;amp;px=999" role="button" title="SGPlot.png" alt="SGPlot.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I want to draw a time-series using SGPLOT. I want to display plane and log versions together because the series is exponential. The only problem is the legend, which repeats the name x just twice. Can I give separate names in this case? The following is the code.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
do t=1 to 5000;
if t=1 then x=1;
else x=x*(1+0.1/12+0.05/sqrt(12)*rannor(1));
output;
end;
run;
ods listing gpath="!userprofile\desktop\";
proc sgplot;
series x=t y=x;
series x=t y=x/y2axis;
xaxis display=(nolabel);
yaxis display=(nolabel);
y2axis display=(nolabel) type=log;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2019 17:54:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Legend-with-One-Variable-Repeated-Twice/m-p/596336#M171686</guid>
      <dc:creator>Junyong</dc:creator>
      <dc:date>2019-10-14T17:54:26Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT Legend with One Variable Repeated Twice</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Legend-with-One-Variable-Repeated-Twice/m-p/596350#M171692</link>
      <description>&lt;P&gt;From SAS 9.4M5, you can do something like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
do t=1 to 5000;
if t=1 then x=1;
else x=x*(1+0.1/12+0.05/sqrt(12)*rannor(1));
output;
end;
run;

proc sgplot;
series x=t y=x;
series x=t y=x/y2axis;
xaxis display=(nolabel);
yaxis display=(nolabel);
y2axis display=(nolabel) type=log;

legenditem type=line name='x1' / label='x' lineattrs=GraphData1;
legenditem type=line name='x2' / label='x (Log)' lineattrs=GraphData2;

keylegend 'x1' 'x2';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="SGPlot4.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/33130iE02500DF9AAF1270/image-size/large?v=v2&amp;amp;px=999" role="button" title="SGPlot4.png" alt="SGPlot4.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2019 19:04:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Legend-with-One-Variable-Repeated-Twice/m-p/596350#M171692</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-10-14T19:04:40Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT Legend with One Variable Repeated Twice</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Legend-with-One-Variable-Repeated-Twice/m-p/596354#M171695</link>
      <description>&lt;P&gt;Or you can do this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot;
series x=t y=x / legendlabel='x';
series x=t y=x / y2axis legendlabel='x (Log)';
xaxis display=(nolabel);
yaxis display=(nolabel);
y2axis display=(nolabel) type=log;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Oct 2019 19:15:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Legend-with-One-Variable-Repeated-Twice/m-p/596354#M171695</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-10-14T19:15:26Z</dc:date>
    </item>
  </channel>
</rss>

