<?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: How to specify color for each group in histogram in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/How-to-specify-color-for-each-group-in-histogram/m-p/832791#M23159</link>
    <description>&lt;P&gt;Good catch! But unfortunately, it didn't work when I fixed as you suggested. I guess the order of color is set by default and hard to change in SAS studio?&lt;/P&gt;</description>
    <pubDate>Sun, 11 Sep 2022 22:39:26 GMT</pubDate>
    <dc:creator>Crystal_F</dc:creator>
    <dc:date>2022-09-11T22:39:26Z</dc:date>
    <item>
      <title>How to specify color for each group in histogram</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-specify-color-for-each-group-in-histogram/m-p/821327#M22940</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a problem having same color for each group when generating multiple figurs. Below is my program. I've also tried reset attrpriority=color, which didn't work neither in SAS studio.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc format;
value Cat_raceeth 2='NON-H Caucasian' 3='NON-H African American' 4='NON-H Asian' 1= 'Hispanic' 5='Other/Unknow';
run;

data myattrmap;
  id="myid"; value=1;
  linecolor="B"; fillcolor="B";
  textcolor="B"; textstyle="normal";
  textweight="normal";
output;

id="myid"; value=2;
  linecolor="R"; fillcolor="R";
  textcolor="R"; textstyle="normal";
  textweight="normal";
output;

id="myid"; value=3;
  linecolor="Y"; fillcolor="Y";
  textcolor="Y"; textstyle="normal";
  textweight="normal";
output;


run;

ods listing gpath = '/Volumes/data/Output/Deliveries063022/Fig';
ods graphics/imagename="Test" imagefmt=png ;
title "Distribution of HbA1C lab result in the last year of follow-up";
title2 "Non-H Caucasian vs. Hispanic";


proc sgplot data=data.descriptives (where=(test_result_A1Clst between 4 and 14 and Cat_raceeth in (1, 2))) dattrmap=myattrmap;   
    histogram test_result_a1clst / group =Cat_raceeth binstart=4 binwidth=0.5 showbins transparency=0.7 attrid=myid;
run;

ods graphics/imagename="Test2" imagefmt=png;
title "Distribution of HbA1C lab result in the last year of follow-up";
title2 "Non-H Caucasian vs. Non-H Black";


proc sgplot data=data.descriptives (where=(test_result_A1Clst between 4 and 14 and Cat_raceeth in (2, 3))) dattrmap=myattrmap;   
    histogram test_result_a1clst / group =Cat_raceeth binstart=4 binwidth=0.5 showbins transparency=0.7 attrid=myid;
run;

ods graphics off;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Note from SAS:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;NOTE: ODS statements in the SAS Studio environment may disable some output features.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The histogram ended up with blue and red for each figure.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Any suggestion would be helpful! Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2022 19:27:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-specify-color-for-each-group-in-histogram/m-p/821327#M22940</guid>
      <dc:creator>Crystal_F</dc:creator>
      <dc:date>2022-07-01T19:27:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to specify color for each group in histogram</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-specify-color-for-each-group-in-histogram/m-p/821351#M22941</link>
      <description>&lt;A href="https://blogs.sas.com/content/graphicallyspeaking/2015/11/30/7180/" target="_blank"&gt;https://blogs.sas.com/content/graphicallyspeaking/2015/11/30/7180/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/graphicallyspeaking/2017/09/10/bar-charts-color-response/" target="_blank"&gt;https://blogs.sas.com/content/graphicallyspeaking/2017/09/10/bar-charts-color-response/&lt;/A&gt;</description>
      <pubDate>Sat, 02 Jul 2022 06:24:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-specify-color-for-each-group-in-histogram/m-p/821351#M22941</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-07-02T06:24:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to specify color for each group in histogram</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-specify-color-for-each-group-in-histogram/m-p/822052#M22949</link>
      <description>&lt;P&gt;Without seeing your data to be sure, I would say that the issue is that &lt;U&gt;&lt;STRONG&gt;formatted&lt;/STRONG&gt;&lt;/U&gt; values of your "cat_raceeth" group variable do not match the values in your attrmap data set. Also, the "value" column should be character, so you should put those values in quotes.&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>Thu, 07 Jul 2022 13:26:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-specify-color-for-each-group-in-histogram/m-p/822052#M22949</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2022-07-07T13:26:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to specify color for each group in histogram</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-specify-color-for-each-group-in-histogram/m-p/832791#M23159</link>
      <description>&lt;P&gt;Good catch! But unfortunately, it didn't work when I fixed as you suggested. I guess the order of color is set by default and hard to change in SAS studio?&lt;/P&gt;</description>
      <pubDate>Sun, 11 Sep 2022 22:39:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-specify-color-for-each-group-in-histogram/m-p/832791#M23159</guid>
      <dc:creator>Crystal_F</dc:creator>
      <dc:date>2022-09-11T22:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to specify color for each group in histogram</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-specify-color-for-each-group-in-histogram/m-p/833580#M23168</link>
      <description>&lt;P&gt;Sorry, just looking at this again. I see the VALUE in you attrmap is formatted into a string by your user-defined format. Therefore, the VALUE in the attrmap needs to be the strings from the format, not the number.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Sep 2022 13:01:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-specify-color-for-each-group-in-histogram/m-p/833580#M23168</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2022-09-15T13:01:24Z</dc:date>
    </item>
  </channel>
</rss>

