<?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 Re: Color bars by group in PROC SGPANEL in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Color-bars-by-group-in-PROC-SGPANEL/m-p/892693#M352598</link>
    <description>&lt;P&gt;You need to include the GROUP= option on the HISTOGRAM statement in PROC SGPANEL. To get exactly the same colors/transparency as in the first image, use&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;histogram Weeks / group=gender transparency=0.5;&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 05 Sep 2023 10:49:35 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2023-09-05T10:49:35Z</dc:date>
    <item>
      <title>Color bars by group in PROC SGPANEL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Color-bars-by-group-in-PROC-SGPANEL/m-p/892645#M352571</link>
      <description>&lt;DIV id="bodyDisplay_25e93e9cc5e1bc" class="lia-message-body lia-component-message-view-widget-body lia-component-body-signature-highlight-escalation lia-component-message-view-widget-body-signature-highlight-escalation"&gt;
&lt;DIV class="lia-message-body-content"&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I've created two graphs from my data, one an overlaid histogram (HISTOGRAM statement) and one a stacked histogram (SGPANEL statement). Here is 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=Surveys;styleattrs datacolors=(blue CXFF00FF);
where gender~='';styleattrs backcolor=white wallcolor=white;
format gender $gender.;histogram Weeks / group=gender transparency=0.5;
xaxis label='Weeks' LABELATTRS=(size=14) VALUEATTRS=(size=13);
keylegend  / title='Gender' TITLEATTRS=(size=16) valueattrs=(size=12); 
yaxis LABELATTRS=(size=14) VALUEATTRS=(size=13) grid GRIDATTRS=(color=LIGGR);run;

proc sgpanel data=Surveys;
styleattrs datacolors=(blue CXFF00FF) datacontrastcolors=(blue CXFF00FF);
where gender~='';  styleattrs  backcolor=white wallcolor=white;
format gender $gender.;panelby gender / rows=2 layout=rowlattice;
 histogram Weeks;
  COLAXIS label='Weeks' LABELATTRS=(size=14) VALUEATTRS=(size=13);
rowaxis  LABELATTRS=(size=14) VALUEATTRS=(size=13) grid GRIDATTRS=(color=LIGGR);
keylegend  / title='Gender' TITLEATTRS=(size=16) valueattrs=(size=12); run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here are the graphs that come out:&lt;/P&gt;
&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="confooseddesi89_2-1693866603788.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/87605iB9DF6D2EC3A8D840/image-size/medium?v=v2&amp;amp;px=400" role="button" title="confooseddesi89_2-1693866603788.png" alt="confooseddesi89_2-1693866603788.png" /&gt;&lt;/span&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="confooseddesi89_3-1693866610621.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/87606i0B4E784668675A13/image-size/medium?v=v2&amp;amp;px=400" role="button" title="confooseddesi89_3-1693866610621.png" alt="confooseddesi89_3-1693866610621.png" /&gt;&lt;/span&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The overlaid histogram (first graph) comes out the way I need with regard to the colors of the bars for each group (blue for male and a purplish color, CXFF00FF, for females). However, I can't figure out how to color the SGPANEL(second graph) the same way, despite using "&lt;CODE class=" language-sas"&gt;styleattrs datacolors=(blue CXFF00FF) datacontrastcolors=(blue CXFF00FF)&lt;/CODE&gt;". I've Googled around and can't seem to find a solution. Can you help? Thanks.&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 04 Sep 2023 22:32:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Color-bars-by-group-in-PROC-SGPANEL/m-p/892645#M352571</guid>
      <dc:creator>confooseddesi89</dc:creator>
      <dc:date>2023-09-04T22:32:30Z</dc:date>
    </item>
    <item>
      <title>Re: Color bars by group in PROC SGPANEL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Color-bars-by-group-in-PROC-SGPANEL/m-p/892693#M352598</link>
      <description>&lt;P&gt;You need to include the GROUP= option on the HISTOGRAM statement in PROC SGPANEL. To get exactly the same colors/transparency as in the first image, use&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;histogram Weeks / group=gender transparency=0.5;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 10:49:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Color-bars-by-group-in-PROC-SGPANEL/m-p/892693#M352598</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2023-09-05T10:49:35Z</dc:date>
    </item>
    <item>
      <title>Re: Color bars by group in PROC SGPANEL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Color-bars-by-group-in-PROC-SGPANEL/m-p/892699#M352601</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*Using GROUP= option*/
proc sgpanel data=sashelp.heart;
panelby sex / rows=2 layout=rowlattice;
histogram weight/group=sex;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1693913300568.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/87614i061E2405E830DAA2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1693913300568.png" alt="Ksharp_0-1693913300568.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 11:27:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Color-bars-by-group-in-PROC-SGPANEL/m-p/892699#M352601</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-09-05T11:27:56Z</dc:date>
    </item>
  </channel>
</rss>

