<?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 Assign colors for stacked bars in GCHART in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Assign-colors-for-stacked-bars-in-GCHART/m-p/497107#M16994</link>
    <description>&lt;P&gt;I have a number of different bar charts that are going into the same presentation.&amp;nbsp; SAS (9.4) is arbitrarily (at least that's how I view it) assigning colors to the segments of the bars and they are not consistent across charts.&amp;nbsp; I would like to assign the colors.&amp;nbsp; &amp;nbsp;In addition, I cannot figure out how to put a border around the whole chart.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have attached&amp;nbsp;sample data...I have many more managers and observations than what is in the sample.&amp;nbsp; I've also attached a snippet of the resulting chart.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Legend1 label=none ;&lt;BR /&gt;ods graphics / border=on ;&lt;BR /&gt;goptions border ;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Proc GCHART data=MgrName ;&lt;BR /&gt;vbar Usage_Month / discrete subgroup=Manager legend=legend1 type = freq ;&lt;BR /&gt;Run ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 19 Sep 2018 19:53:54 GMT</pubDate>
    <dc:creator>NancyBerkley</dc:creator>
    <dc:date>2018-09-19T19:53:54Z</dc:date>
    <item>
      <title>Assign colors for stacked bars in GCHART</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Assign-colors-for-stacked-bars-in-GCHART/m-p/497107#M16994</link>
      <description>&lt;P&gt;I have a number of different bar charts that are going into the same presentation.&amp;nbsp; SAS (9.4) is arbitrarily (at least that's how I view it) assigning colors to the segments of the bars and they are not consistent across charts.&amp;nbsp; I would like to assign the colors.&amp;nbsp; &amp;nbsp;In addition, I cannot figure out how to put a border around the whole chart.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have attached&amp;nbsp;sample data...I have many more managers and observations than what is in the sample.&amp;nbsp; I've also attached a snippet of the resulting chart.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Legend1 label=none ;&lt;BR /&gt;ods graphics / border=on ;&lt;BR /&gt;goptions border ;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Proc GCHART data=MgrName ;&lt;BR /&gt;vbar Usage_Month / discrete subgroup=Manager legend=legend1 type = freq ;&lt;BR /&gt;Run ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Sep 2018 19:53:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Assign-colors-for-stacked-bars-in-GCHART/m-p/497107#M16994</guid>
      <dc:creator>NancyBerkley</dc:creator>
      <dc:date>2018-09-19T19:53:54Z</dc:date>
    </item>
    <item>
      <title>Re: Assign colors for stacked bars in GCHART</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Assign-colors-for-stacked-bars-in-GCHART/m-p/497111#M16995</link>
      <description>&lt;P&gt;Gchart generally assigns appearance based on the order of appearance of a&amp;nbsp;value in the data&amp;nbsp;matched against the current list of PATTERN statements in effect. The "randomness" may be reduced by sorting the data by that variable so the values appear in order more often.&lt;/P&gt;
&lt;P&gt;As such, keeping colors/ patterns/symbols consistent for "Fred", especially when "Fred" does not appear in every graph is extremely challenging.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might want to consider moving to Proc SGPLOT / SGPANEL. The later versions of SAS include the statistical graph procedures as part of the base SAS installation. The feature you are looking for involves DATTRMAP data sets where you can create a data set that supplies one or more sets of rules so that "Fred" will always have the same color, pattern, marker symbol, line pattern or other graphics appearance option.&lt;/P&gt;
&lt;P&gt;This really is not a short 3 or 3 line to describe and us though. Look in the documentation for Proc SGPLOT statement&amp;nbsp;and the option DATTRMAP. SGPANEL is similar but allows showing graphs with a separate graph for each combination of one or more other variables.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Sep 2018 20:06:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Assign-colors-for-stacked-bars-in-GCHART/m-p/497111#M16995</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-09-19T20:06:42Z</dc:date>
    </item>
    <item>
      <title>Re: Assign colors for stacked bars in GCHART</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Assign-colors-for-stacked-bars-in-GCHART/m-p/497116#M16996</link>
      <description>&lt;P&gt;Here is a simple example:&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" linecolor "black";
input value $ fillcolor $;
cards;
F pink
M blue
;
run;

proc sgplot data=sashelp.class dattrmap=attrmap;
vbar age / response=weight stat=mean group=sex
           attrid=myid groupdisplay=cluster;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Sep 2018 20:16:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Assign-colors-for-stacked-bars-in-GCHART/m-p/497116#M16996</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2018-09-19T20:16:26Z</dc:date>
    </item>
  </channel>
</rss>

