<?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 Change Colors in PROC SGPANEL by group in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Change-Colors-in-PROC-SGPANEL-by-group/m-p/943339#M42380</link>
    <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using proc sgpanel and have created the following histogram.&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="graph.PNG" style="width: 689px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/100155iFCD3FDE935C311F9/image-size/large?v=v2&amp;amp;px=999" role="button" title="graph.PNG" alt="graph.PNG" /&gt;&lt;/span&gt;using the following code:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;title 'alcohol gm/d by sex - count';
proc sgpanel data=amd2prog_p noautolegend;
 panelby Sex;
 histogram alc_gm_d/ scale=count group=sex;
 density alc_gm_d;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I was wondering if there is a way to change the colors of the groups? For example, to make sex=male green and sex=female pink or something?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Tue, 10 Sep 2024 17:16:50 GMT</pubDate>
    <dc:creator>spidersgeorg</dc:creator>
    <dc:date>2024-09-10T17:16:50Z</dc:date>
    <item>
      <title>Change Colors in PROC SGPANEL by group</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Change-Colors-in-PROC-SGPANEL-by-group/m-p/943339#M42380</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using proc sgpanel and have created the following histogram.&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="graph.PNG" style="width: 689px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/100155iFCD3FDE935C311F9/image-size/large?v=v2&amp;amp;px=999" role="button" title="graph.PNG" alt="graph.PNG" /&gt;&lt;/span&gt;using the following code:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;title 'alcohol gm/d by sex - count';
proc sgpanel data=amd2prog_p noautolegend;
 panelby Sex;
 histogram alc_gm_d/ scale=count group=sex;
 density alc_gm_d;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I was wondering if there is a way to change the colors of the groups? For example, to make sex=male green and sex=female pink or something?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2024 17:16:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Change-Colors-in-PROC-SGPANEL-by-group/m-p/943339#M42380</guid>
      <dc:creator>spidersgeorg</dc:creator>
      <dc:date>2024-09-10T17:16:50Z</dc:date>
    </item>
    <item>
      <title>Re: Change Colors in PROC SGPANEL by group</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Change-Colors-in-PROC-SGPANEL-by-group/m-p/943371#M42381</link>
      <description>&lt;P&gt;In increasing complexity:&lt;/P&gt;
&lt;P&gt;1) use the Styleattrs statement to set graph properties.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; add Styleattrs datacolors=(pink green); to your graph.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; The first color will go with the first encountered group value. So Female would be before Male with the PanelBY, and Pink would associate with Female.&lt;/P&gt;
&lt;P&gt;The fun part with this finding which attribute: Datacolors, Datacontrastcolors, Datafillpatterns, Datalinepatterns or Datasymbols need to be used for which element of the graph.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) a DATTRMAP data set, discrete attribute map, which contains specific variable names to link values to the color, contrast color, line attribute, text color or attribute. The data set would be referenced on the Proc Sgpanel (or Sgplot) statement and the plot statements, such as your Histogram would include an ATTRID= option to indicate which values of the ID variable are used with that statement&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3) Create a custom style using Proc Template and make that the active ODS style for the procedure by using it with the STYLE=option of an ODS destination statement.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2024 19:05:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Change-Colors-in-PROC-SGPANEL-by-group/m-p/943371#M42381</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-09-10T19:05:44Z</dc:date>
    </item>
    <item>
      <title>Re: Change Colors in PROC SGPANEL by group</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Change-Colors-in-PROC-SGPANEL-by-group/m-p/943374#M42382</link>
      <description>&lt;P&gt;Using&amp;nbsp;dattrmap !&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data myattrs;
length value $10 fillcolor $12;
show='AttrMap';
id="some_id";
value='F'; fillcolor="yellow"; output;
value='M'; fillcolor="purple"; output;
run;

title1 h=18pt ls=1.5 "ODS Graphics - Color Control";

proc sgpanel data=sashelp.class dattrmap=myattrs noautolegend
                                pad=(left=10pct right=10pct);
 panelby Sex;
 histogram height / scale=count group=sex attrid=some_id;
 density height;
run;
/* end of program */&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2024 19:42:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Change-Colors-in-PROC-SGPANEL-by-group/m-p/943374#M42382</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2024-09-10T19:42:52Z</dc:date>
    </item>
  </channel>
</rss>

