<?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 bygroup color in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-bygroup-color/m-p/281792#M9980</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am plotting a series plot using sgplot. The group variable is subject. I am getting a nice plot with different subject plotted in different color. Now I need to color these subject (lines) by treatment. I still want to use subject as group variable but now I want to color the lines on graph as per the treatment. Is there any option to do that within sgplot?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 01 Jul 2016 20:04:45 GMT</pubDate>
    <dc:creator>Leo9</dc:creator>
    <dc:date>2016-07-01T20:04:45Z</dc:date>
    <item>
      <title>PROC SGPLOT bygroup color</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-bygroup-color/m-p/281792#M9980</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am plotting a series plot using sgplot. The group variable is subject. I am getting a nice plot with different subject plotted in different color. Now I need to color these subject (lines) by treatment. I still want to use subject as group variable but now I want to color the lines on graph as per the treatment. Is there any option to do that within sgplot?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 20:04:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-bygroup-color/m-p/281792#M9980</guid>
      <dc:creator>Leo9</dc:creator>
      <dc:date>2016-07-01T20:04:45Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT bygroup color</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-bygroup-color/m-p/281794#M9981</link>
      <description>&lt;P&gt;You didn't mention your version of SAS, but try the tricks and links in this article: &lt;A href="http://blogs.sas.com/content/graphicallyspeaking/2013/07/14/setting-graph-colors-is-easier-with-sas-9-4/" target="_self"&gt;"Setting Group Colors"&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 20:08:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-bygroup-color/m-p/281794#M9981</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-07-01T20:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT bygroup color</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-bygroup-color/m-p/281795#M9982</link>
      <description>&lt;P&gt;I am using 9.4. Here is ths partial code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;series x=visitn y=lbstresn / group = subjid markers lineattrs = (thickness = 1) markerattrs=(symbol=circlefilled size = 4) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By default , SAS picks different color for each subjects. I would like to color these subjects data by treatment.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 20:19:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-bygroup-color/m-p/281795#M9982</guid>
      <dc:creator>Leo9</dc:creator>
      <dc:date>2016-07-01T20:19:05Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT bygroup color</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-bygroup-color/m-p/281797#M9983</link>
      <description>&lt;P&gt;Ahh, you're trying to display a spaghetti plot. Use&lt;/P&gt;
&lt;P&gt;GROUPLC=treatment&lt;/P&gt;
&lt;P&gt;For more on spaghetti plots, see &lt;A href="http://blogs.sas.com/content/iml/2016/06/02/create-spaghetti-plots-in-sas.html" target="_self"&gt;"Create spaghetti plots in SAS."&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;For more on line colors and styles, see &lt;A href="http://blogs.sas.com/content/graphicallyspeaking/2014/08/12/creating-spaghetti-plots-just-got-easy/" target="_self"&gt;"Creating spaghetti plots just got easy."&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 20:33:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-bygroup-color/m-p/281797#M9983</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-07-01T20:33:00Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT bygroup color</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-bygroup-color/m-p/281800#M9984</link>
      <description>&lt;P&gt;You are only allowed one variable for sgplot grouping. So you need to create a new variable that represents the combination of subjid and treatment:&lt;/P&gt;
&lt;P&gt;group = catx(" - ", subjId, treatment);&lt;/P&gt;
&lt;P&gt;and then use an attribute map dataset with sgplot to associate groups with graphical attributes. I find it the most reliable method to do so.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 20:39:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-bygroup-color/m-p/281800#M9984</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-07-01T20:39:32Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT bygroup color</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-bygroup-color/m-p/281805#M9985</link>
      <description>&lt;P&gt;I'm not sure of your SAS 9.4 maintenance version, but we added support for extra levels of subgrouping for series plots (starting in SAS9.4m2). In your case, you would use the GROUPLC option:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;SPAN&gt;series x=visitn y=lbstresn / group = subjid grouplc=treatment markers lineattrs = (thickness = 1) markerattrs=(symbol=circlefilled size = 4) ;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Hope that works for you!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Dan&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 21:37:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-bygroup-color/m-p/281805#M9985</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2016-07-01T21:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT bygroup color</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-bygroup-color/m-p/285397#M10106</link>
      <description>&lt;P&gt;So the grouplc works but the legend is still displayed based on subject as subject is by group.&lt;/P&gt;&lt;P&gt;How can I display correct legend based on treatment?&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jul 2016 22:45:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-bygroup-color/m-p/285397#M10106</guid>
      <dc:creator>Leo9</dc:creator>
      <dc:date>2016-07-18T22:45:00Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT bygroup color</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-bygroup-color/m-p/285403#M10108</link>
      <description>In this case: How you do you define legends at the bottom ? How do you make sure they are based only on treatment ?</description>
      <pubDate>Mon, 18 Jul 2016 23:05:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-bygroup-color/m-p/285403#M10108</guid>
      <dc:creator>Leo9</dc:creator>
      <dc:date>2016-07-18T23:05:32Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT bygroup color</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-bygroup-color/m-p/285420#M10113</link>
      <description>&lt;P&gt;The only trick I can think of to achieve that (without the new grouplc option) is to insert missing values between subjects and use the BREAK option so that each treatment is a single series broken into many subject lines.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2016 02:29:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-bygroup-color/m-p/285420#M10113</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-07-19T02:29:43Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT bygroup color</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-bygroup-color/m-p/285421#M10114</link>
      <description>&lt;P&gt;Use the TYPE= option on the KEYLEGEND statement to choose the attributes to display. In the case of:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;series x=visitn y=lbstresn / group = subjid grouplc=treatment markers lineattrs = (thickness = 1) &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;markerattrs=(symbol=circlefilled size = 4) name="series";&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;keylegend "series" / type=linecolor; /* because treatment is assigned to GROUPLC */&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2016 02:32:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-bygroup-color/m-p/285421#M10114</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2016-07-19T02:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT bygroup color</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-bygroup-color/m-p/285602#M10116</link>
      <description>&lt;P&gt;Thanks Dan. Is it possible the values in legend in a particular order ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2016 18:30:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-bygroup-color/m-p/285602#M10116</guid>
      <dc:creator>Leo9</dc:creator>
      <dc:date>2016-07-19T18:30:49Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT bygroup color</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-bygroup-color/m-p/285605#M10117</link>
      <description>&lt;P&gt;On the KEYLEGEND statement, you can set the SORTORDER to be ASCENDING or DESCENDING. If you need precise control over the ordering, there is a way to use discrete attribute maps to do it. Let me know if you need an example of that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;BR /&gt;Dan&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2016 18:41:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-bygroup-color/m-p/285605#M10117</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2016-07-19T18:41:59Z</dc:date>
    </item>
  </channel>
</rss>

