<?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 How to use Proc sgplot to generate multiple lines in one graph? in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/How-to-use-Proc-sgplot-to-generate-multiple-lines-in-one-graph/m-p/29118#M847</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What if you use a group variable on your series plot statement.&lt;/P&gt;&lt;P&gt;Series x=month y=rate group=store / ...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Jan 2012 19:02:34 GMT</pubDate>
    <dc:creator>ScottS_SAS</dc:creator>
    <dc:date>2012-01-12T19:02:34Z</dc:date>
    <item>
      <title>How to use Proc sgplot to generate multiple lines in one graph?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-use-Proc-sgplot-to-generate-multiple-lines-in-one-graph/m-p/29117#M846</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; I have no problem to generate one line using Proc sgplot like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data graphdata;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input month $ store $ rate;&lt;/P&gt;&lt;P&gt;&amp;nbsp; datalines;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Jan store1 20&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Feb stroe1 25&lt;/P&gt;&lt;P&gt;&amp;nbsp; ; &lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sgplot data=graphdata;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; series x=month y=rate/markers &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lineattrs=(color=blue)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; markerattrs=(symbol=circlefilled color=blue)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; legendlabel='rates for store1';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; xaxis type=discrete grid label=' ';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; yaxis label= 'rate' grid values=(0 to 60 by 10);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Above code generate a line for store1, with xaxis having month and yaxis with rates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, I have problem to try to generate multiple for multiple stores when my dataset has data for more than one stores, E.g. if my data is like this:&lt;/P&gt;&lt;P&gt;data graphdata;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input month $ store $ rate;&lt;/P&gt;&lt;P&gt;&amp;nbsp; datalines;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Jan store1 20&lt;/P&gt;&lt;P&gt;&amp;nbsp; Feb store1 25&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; Jan store2 30&lt;/P&gt;&lt;P&gt;&amp;nbsp; Feb store2 40&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; Jan store3 55&lt;/P&gt;&lt;P&gt;&amp;nbsp; Feb store3 45&lt;/P&gt;&lt;P&gt;&amp;nbsp; ; &lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jan 2012 18:48:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-use-Proc-sgplot-to-generate-multiple-lines-in-one-graph/m-p/29117#M846</guid>
      <dc:creator>Fisher</dc:creator>
      <dc:date>2012-01-12T18:48:52Z</dc:date>
    </item>
    <item>
      <title>How to use Proc sgplot to generate multiple lines in one graph?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-use-Proc-sgplot-to-generate-multiple-lines-in-one-graph/m-p/29118#M847</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What if you use a group variable on your series plot statement.&lt;/P&gt;&lt;P&gt;Series x=month y=rate group=store / ...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jan 2012 19:02:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-use-Proc-sgplot-to-generate-multiple-lines-in-one-graph/m-p/29118#M847</guid>
      <dc:creator>ScottS_SAS</dc:creator>
      <dc:date>2012-01-12T19:02:34Z</dc:date>
    </item>
    <item>
      <title>How to use Proc sgplot to generate multiple lines in one graph?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-use-Proc-sgplot-to-generate-multiple-lines-in-one-graph/m-p/29119#M848</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Use:&amp;nbsp; series x=month y=rate / &lt;STRONG&gt;group=store;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jan 2012 19:06:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-use-Proc-sgplot-to-generate-multiple-lines-in-one-graph/m-p/29119#M848</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2012-01-12T19:06:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Proc sgplot to generate multiple lines in one graph?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-use-Proc-sgplot-to-generate-multiple-lines-in-one-graph/m-p/29120#M849</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Excellent! Thanks Sanjay. I had thought I need to add multiple series statement somehow.&lt;/P&gt;&lt;P&gt;BTW, this way the SAS will automatically assign the graph bagroud color, line types and colors. How can I customize them, such as changing the background color as white, and use only solid line? I tried&lt;SPAN style="color: #008080;"&gt; goptions cback=white&lt;/SPAN&gt;, but it didn't seems work. &lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jan 2012 19:38:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-use-Proc-sgplot-to-generate-multiple-lines-in-one-graph/m-p/29120#M849</guid>
      <dc:creator>Fisher</dc:creator>
      <dc:date>2012-01-12T19:38:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Proc sgplot to generate multiple lines in one graph?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-use-Proc-sgplot-to-generate-multiple-lines-in-one-graph/m-p/29121#M850</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If your data is grouped (as it is, with different store names), then the group attributes come from the style.&amp;nbsp; Each series will use different attributes like color, pattern from GraphData1 - GraphDataN.&amp;nbsp; You can force all lines to be solid by setting the lineattrs option:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE lang="sas"&gt;series x=month y=rate / group=store lineattrs=(pattern=solid);&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note, the attribute change is an override, so all the lines will now have solid pattern.&amp;nbsp; To change the colors, you will have to change the settings in the style, unless you have SAS 9.3.&amp;nbsp; In SAS 9.3, you can use an ATTRMAP to assign custom colors by store name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have multiple response type data structure, where each store has its own column (below), then you will use multiple SERIES plot statements, one for each series.&amp;nbsp; In this case, you can assign the attributes for each series independently&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE lang="sas"&gt;data graphdata;
input month $ store1 store2 store3;
datalines;
Jan 20 25 30
Feb 20 35 40
;
run;

proc sgplot data=graphdata nocycleattrs;
&amp;nbsp; series x=month y=store1 / lineattrs=(color=blue);
&amp;nbsp; series x=month y=store2 / lineattrs=(color=red);
&amp;nbsp; run;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jan 2012 20:16:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-use-Proc-sgplot-to-generate-multiple-lines-in-one-graph/m-p/29121#M850</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2012-01-12T20:16:14Z</dc:date>
    </item>
  </channel>
</rss>

