<?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 proc sgplot - plot multiple variables on one graph in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-plot-multiple-variables-on-one-graph/m-p/577418#M18574</link>
    <description>&lt;P&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;[using EG 9.4]&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;I have a data set that looks like this:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;product sale_date   price 
abc     01/01/2018  1.13 
abc     06/01/2018  1.29 
abc     02/02/2018  1.23 
xyz     02/01/2018  1.54 
xyz     08/01/2018  1.58 
xyz     03/02/2018  1.41&lt;/PRE&gt;&lt;P&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;And I need to plot two series (one for each product) on a pbspline plot of "price vs date".&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;I have tried a number of variations but am unable to get two separate series. Here's what I used most recently:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods graphics on / height=600 width=900 noborder;
proc sgplot data=work.product_daily_sales(where=(product IN ('abc', 'xyz')));
by product;
pbspline x=sale_date y=price / legendlabel='company1' markerattrs=(symbol=circle color=blue size=5) lineattrs=(color=blue);
pbspline x=sale_date y=price /  legendlabel='company2' markerattrs=(symbol=circle color=red size=5) lineattrs=(color=red);
xaxis label='Date';
yaxis  label='US Price ($)';
title 'Sales Price by date of sale';
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;Basically, I am comparing prices for a similar product to two different companies and I need to show the difference in pricing on the one graph.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;The above code gets me closest to what I want but displays two graphs.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;Can anyone help?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;Thanks in advance.&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 29 Jul 2019 15:59:40 GMT</pubDate>
    <dc:creator>chuckd</dc:creator>
    <dc:date>2019-07-29T15:59:40Z</dc:date>
    <item>
      <title>proc sgplot - plot multiple variables on one graph</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-plot-multiple-variables-on-one-graph/m-p/577418#M18574</link>
      <description>&lt;P&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;[using EG 9.4]&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;I have a data set that looks like this:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;product sale_date   price 
abc     01/01/2018  1.13 
abc     06/01/2018  1.29 
abc     02/02/2018  1.23 
xyz     02/01/2018  1.54 
xyz     08/01/2018  1.58 
xyz     03/02/2018  1.41&lt;/PRE&gt;&lt;P&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;And I need to plot two series (one for each product) on a pbspline plot of "price vs date".&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;I have tried a number of variations but am unable to get two separate series. Here's what I used most recently:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods graphics on / height=600 width=900 noborder;
proc sgplot data=work.product_daily_sales(where=(product IN ('abc', 'xyz')));
by product;
pbspline x=sale_date y=price / legendlabel='company1' markerattrs=(symbol=circle color=blue size=5) lineattrs=(color=blue);
pbspline x=sale_date y=price /  legendlabel='company2' markerattrs=(symbol=circle color=red size=5) lineattrs=(color=red);
xaxis label='Date';
yaxis  label='US Price ($)';
title 'Sales Price by date of sale';
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;Basically, I am comparing prices for a similar product to two different companies and I need to show the difference in pricing on the one graph.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;The above code gets me closest to what I want but displays two graphs.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;Can anyone help?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;Thanks in advance.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2019 15:59:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-plot-multiple-variables-on-one-graph/m-p/577418#M18574</guid>
      <dc:creator>chuckd</dc:creator>
      <dc:date>2019-07-29T15:59:40Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgplot - plot multiple variables on one graph</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-plot-multiple-variables-on-one-graph/m-p/577422#M18575</link>
      <description>You don't want a BY statement. Instead what you want is a GROUP= option on the PBSPLINE statement that specifies PRODUCT as your GROUP variable.</description>
      <pubDate>Mon, 29 Jul 2019 16:07:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-plot-multiple-variables-on-one-graph/m-p/577422#M18575</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-29T16:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgplot - plot multiple variables on one graph</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-plot-multiple-variables-on-one-graph/m-p/577423#M18576</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods graphics on / height=600 width=900 noborder;
proc sgplot data=work.product_daily_sales(where=(product IN ('abc', 'xyz')));

pbspline x=sale_date y=price / group=product markerattrs=(symbol=circle color=blue size=5) lineattrs=(color=blue);
xaxis label='Date';
yaxis  label='US Price ($)';
title 'Sales Price by date of sale';
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/283251"&gt;@chuckd&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;[using EG 9.4]&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;I have a data set that looks like this:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;product sale_date   price 
abc     01/01/2018  1.13 
abc     06/01/2018  1.29 
abc     02/02/2018  1.23 
xyz     02/01/2018  1.54 
xyz     08/01/2018  1.58 
xyz     03/02/2018  1.41&lt;/PRE&gt;
&lt;P&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;And I need to plot two series (one for each product) on a pbspline plot of "price vs date".&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;I have tried a number of variations but am unable to get two separate series. Here's what I used most recently:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods graphics on / height=600 width=900 noborder;
proc sgplot data=work.product_daily_sales(where=(product IN ('abc', 'xyz')));
by product;
pbspline x=sale_date y=price / legendlabel='company1' markerattrs=(symbol=circle color=blue size=5) lineattrs=(color=blue);
pbspline x=sale_date y=price /  legendlabel='company2' markerattrs=(symbol=circle color=red size=5) lineattrs=(color=red);
xaxis label='Date';
yaxis  label='US Price ($)';
title 'Sales Price by date of sale';
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;Basically, I am comparing prices for a similar product to two different companies and I need to show the difference in pricing on the one graph.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;The above code gets me closest to what I want but displays two graphs.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;Can anyone help?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;Thanks in advance.&lt;/FONT&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2019 16:08:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-plot-multiple-variables-on-one-graph/m-p/577423#M18576</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-29T16:08:23Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgplot - plot multiple variables on one graph</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-plot-multiple-variables-on-one-graph/m-p/577470#M18577</link>
      <description>&lt;P&gt;Thanks. I was almost there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In cases like this, how do you change the marker and line attributes of the different series (products in this case)? So they're both not in blue.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2019 18:11:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-plot-multiple-variables-on-one-graph/m-p/577470#M18577</guid>
      <dc:creator>chuckd</dc:creator>
      <dc:date>2019-07-29T18:11:27Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgplot - plot multiple variables on one graph</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-plot-multiple-variables-on-one-graph/m-p/577502#M18578</link>
      <description>You could list them in the STYLEATTRS statement but I prefer using a data attribute map. I just find it simpler and cleaner to deal with.&lt;BR /&gt;&lt;BR /&gt;There's examples here:&lt;BR /&gt;&lt;A href="https://documentation.sas.com/?docsetId=grstatproc&amp;amp;docsetTarget=n18szqcwir8q2nn10od9hhdh2ksj.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;https://documentation.sas.com/?docsetId=grstatproc&amp;amp;docsetTarget=n18szqcwir8q2nn10od9hhdh2ksj.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;</description>
      <pubDate>Mon, 29 Jul 2019 19:39:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-plot-multiple-variables-on-one-graph/m-p/577502#M18578</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-29T19:39:15Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgplot - plot multiple variables on one graph</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-plot-multiple-variables-on-one-graph/m-p/578715#M18611</link>
      <description>OK. I read about them but wasn't too sure that's what I needed. Thanks for your help.</description>
      <pubDate>Fri, 02 Aug 2019 14:19:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-plot-multiple-variables-on-one-graph/m-p/578715#M18611</guid>
      <dc:creator>chuckd</dc:creator>
      <dc:date>2019-08-02T14:19:44Z</dc:date>
    </item>
  </channel>
</rss>

