<?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 Grouping in sgplot : Assign 2 different colors in markerattrs ? in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Grouping-in-sgplot-Assign-2-different-colors-in-markerattrs/m-p/386070#M13231</link>
    <description>&lt;P&gt;Hello SasCommunity, I need your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 3 columns Coco1, Coco2 and alert. alert is just composed by 0 or 1. I managed to plot Coco1 vs Coco2 by grouping them regarding if alert = 0 or 1 but when I tried to assign the black color for the ones with alert = 0 and the red color for the ones with alert = 1, it doesn't work anymore (all circles are in black).&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-inline" image-alt="Zoom.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/14361iCBE4644E74C81075/image-size/large?v=v2&amp;amp;px=999" role="button" title="Zoom.png" alt="Zoom.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I tried "styleattrs" or "datacolors = (red black)" next to "data=affichage" but nothing worked.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's my code :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=Affichage;
/*  styleattrs datacolors=(black red) datasymbols=(circlefilled);*/

 scatter x=EC_rate y=NI_rate/ group=alert markerattrs=(color=&lt;FONT color="#ff0000"&gt;black&lt;/FONT&gt; symbol=circlefilled); ;

 lineparm x=0 y=0 slope=1/ lineattrs=(color=green) curvelabel="100%";
 lineparm x=0 y=0 slope=.5/ lineattrs=(color=red) curvelabel="50%";
 lineparm x=0 y=0 slope=.25/ lineattrs=(color=blue) curvelabel="25%";
 title "Zoom coco";
 xaxis grid min=0;
 yaxis grid;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone help me please? Thanks in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 07 Aug 2017 16:19:33 GMT</pubDate>
    <dc:creator>Semsem</dc:creator>
    <dc:date>2017-08-07T16:19:33Z</dc:date>
    <item>
      <title>Grouping in sgplot : Assign 2 different colors in markerattrs ?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Grouping-in-sgplot-Assign-2-different-colors-in-markerattrs/m-p/386070#M13231</link>
      <description>&lt;P&gt;Hello SasCommunity, I need your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 3 columns Coco1, Coco2 and alert. alert is just composed by 0 or 1. I managed to plot Coco1 vs Coco2 by grouping them regarding if alert = 0 or 1 but when I tried to assign the black color for the ones with alert = 0 and the red color for the ones with alert = 1, it doesn't work anymore (all circles are in black).&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-inline" image-alt="Zoom.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/14361iCBE4644E74C81075/image-size/large?v=v2&amp;amp;px=999" role="button" title="Zoom.png" alt="Zoom.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I tried "styleattrs" or "datacolors = (red black)" next to "data=affichage" but nothing worked.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's my code :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=Affichage;
/*  styleattrs datacolors=(black red) datasymbols=(circlefilled);*/

 scatter x=EC_rate y=NI_rate/ group=alert markerattrs=(color=&lt;FONT color="#ff0000"&gt;black&lt;/FONT&gt; symbol=circlefilled); ;

 lineparm x=0 y=0 slope=1/ lineattrs=(color=green) curvelabel="100%";
 lineparm x=0 y=0 slope=.5/ lineattrs=(color=red) curvelabel="50%";
 lineparm x=0 y=0 slope=.25/ lineattrs=(color=blue) curvelabel="25%";
 title "Zoom coco";
 xaxis grid min=0;
 yaxis grid;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone help me please? Thanks in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Aug 2017 16:19:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Grouping-in-sgplot-Assign-2-different-colors-in-markerattrs/m-p/386070#M13231</guid>
      <dc:creator>Semsem</dc:creator>
      <dc:date>2017-08-07T16:19:33Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping in sgplot : Assign 2 different colors in markerattrs ?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Grouping-in-sgplot-Assign-2-different-colors-in-markerattrs/m-p/386072#M13232</link>
      <description>&lt;P&gt;Use an attributes map:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data attrmap;
retain id "myid";
length markercolor $ 5;
input value $ markercolor $;
cards;
0 red
1 black
;
run;

proc sgplot data=Affichage dattrmap=attrmap;
/*  styleattrs datacolors=(black red) datasymbols=(circlefilled);*/

 scatter x=EC_rate y=NI_rate/ group=alert markerattrs=(color=black symbol=circlefilled) attrid=myid;

 lineparm x=0 y=0 slope=1/ lineattrs=(color=green) curvelabel="100%";
 lineparm x=0 y=0 slope=.5/ lineattrs=(color=red) curvelabel="50%";
 lineparm x=0 y=0 slope=.25/ lineattrs=(color=blue) curvelabel="25%";
 title "Zoom coco";
 xaxis grid min=0;
 yaxis grid;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Take a look at this post for more details.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;
&lt;P&gt;Dan&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 17:07:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Grouping-in-sgplot-Assign-2-different-colors-in-markerattrs/m-p/386072#M13232</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2017-08-09T17:07:24Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping in sgplot : Assign 2 different colors in markerattrs ?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Grouping-in-sgplot-Assign-2-different-colors-in-markerattrs/m-p/386074#M13233</link>
      <description>&lt;P&gt;When you have a group variable that has 2 values, the colors come from the Styles's GraphData1-12 color list. &amp;nbsp;The first group gets GraphData1 (usually blue) and the second will get GraphData2 (often Red). &amp;nbsp;The colors are based on the style. &amp;nbsp;Now, if you set the color to black in the syntax, these group colors are overridden by the single color you set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want certain specific group colors based on group value, you can use the DiscreteAttrMap code suggested by Dan. &amp;nbsp;If you just want two different colors, not specifically based on value, set STYLEATTRS statement with Datacolors=(red black).&lt;/P&gt;</description>
      <pubDate>Mon, 07 Aug 2017 16:39:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Grouping-in-sgplot-Assign-2-different-colors-in-markerattrs/m-p/386074#M13233</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2017-08-07T16:39:53Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping in sgplot : Assign 2 different colors in markerattrs ?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Grouping-in-sgplot-Assign-2-different-colors-in-markerattrs/m-p/386705#M13261</link>
      <description>&lt;P&gt;Thank you very much for the code. Sorry for the late answer, I&amp;nbsp;tried the code but I get the error&amp;nbsp; :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR 22-322: Expecting a name.&lt;/P&gt;&lt;P&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Apparently it's because of&amp;nbsp;: attrid="myid"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you have an idea about what is the problem?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit :&amp;nbsp; ok, just in case for someone else, just replace attrid="myid" by attrid=myid&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you everyone&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 17:02:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Grouping-in-sgplot-Assign-2-different-colors-in-markerattrs/m-p/386705#M13261</guid>
      <dc:creator>Semsem</dc:creator>
      <dc:date>2017-08-09T17:02:44Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping in sgplot : Assign 2 different colors in markerattrs ?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Grouping-in-sgplot-Assign-2-different-colors-in-markerattrs/m-p/386713#M13262</link>
      <description>&lt;P&gt;Lose the quotes around myid.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 17:01:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Grouping-in-sgplot-Assign-2-different-colors-in-markerattrs/m-p/386713#M13262</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2017-08-09T17:01:25Z</dc:date>
    </item>
  </channel>
</rss>

