<?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: Change fill attributes based on date SGPLOT in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Change-fill-attributes-based-on-date-SGPLOT/m-p/471721#M16282</link>
    <description>&lt;P&gt;Reeza's solution will work as well.&lt;/P&gt;</description>
    <pubDate>Wed, 20 Jun 2018 15:02:49 GMT</pubDate>
    <dc:creator>DanH_sas</dc:creator>
    <dc:date>2018-06-20T15:02:49Z</dc:date>
    <item>
      <title>Change fill attributes based on date SGPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Change-fill-attributes-based-on-date-SGPLOT/m-p/471593#M16279</link>
      <description>&lt;P&gt;Hi All&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm using the following SGPLOT to produce a bar chart - however I would like to change the colour of the fill attributes based on the date (indicated by P - I can't add dates successfully to test data &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; ) to identify when a change occurred to the business rules.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data test; 
Input Date $ Result; 
Datalines;
A 117
B 76
C 60
D 52
E 75
F 63
G 70
H 73
I 58
J 52
K 32
L 120
M 73
N 62
O 71
P 108
Q 85
;
Run;

Proc SGPLOT data=test noborder;
Title "Results"; 
VBAR Date / RESPONSE=Result FILLATTRS=(Color=BIBG) ;
 yaxis display=(noline noticks) ;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The output result is in the Current Result graph and I would like it to look like Required Results graph.&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="Graphs1.JPG" style="width: 263px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21281i2C36938D073B23B1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Graphs1.JPG" alt="Graphs1.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How do I change my code to show different colours? Any help appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Dean&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jun 2018 14:43:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Change-fill-attributes-based-on-date-SGPLOT/m-p/471593#M16279</guid>
      <dc:creator>DME790</dc:creator>
      <dc:date>2018-06-20T14:43:01Z</dc:date>
    </item>
    <item>
      <title>Re: Change fill attributes based on date SGPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Change-fill-attributes-based-on-date-SGPLOT/m-p/471715#M16280</link>
      <description>&lt;P&gt;You can use the approach here and then style your colors using either STYLEATTRS or an attribute map.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data test; 
Input Date $ Result Group; 
Datalines;
A 117 1
B 76 1
C 60 1
D 52 1
E 75 1
F 63 1
G 70 1
H 73 1
I 58 1
J 52 1
K 32 1
L 120 1
M 73 1
N 62 1
O 71 1
P 108 0
Q 85 0
;
Run;

Proc SGPLOT data=test noborder noautolegend;
Title "Results"; 
VBAR Date / RESPONSE=Result group=group ;
 yaxis display=(noline noticks) ;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;PS. I'm moving your question to the graphics forum as well.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jun 2018 14:43:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Change-fill-attributes-based-on-date-SGPLOT/m-p/471715#M16280</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-06-20T14:43:51Z</dc:date>
    </item>
    <item>
      <title>Re: Change fill attributes based on date SGPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Change-fill-attributes-based-on-date-SGPLOT/m-p/471720#M16281</link>
      <description>&lt;P&gt;You need to use an attribute map. Here is the code:&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 fillcolor $ 4;
input value $ fillcolor $;
cards;
P       red
Q       red
_other_ bibg
;
run;

Data test;
Input Date $ Result;
Datalines;
A 117
B 76
C 60
D 52
E 75
F 63
G 70
H 73
I 58
J 52
K 32
L 120
M 73
N 62
O 71
P 108
Q 85
;
Run;

Proc SGPLOT data=test dattrmap=attrmap noborder;
Title "Results";
VBAR Date / RESPONSE=Result group=date attrid=myid;
 yaxis display=(noline noticks) ;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Jun 2018 15:01:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Change-fill-attributes-based-on-date-SGPLOT/m-p/471720#M16281</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2018-06-20T15:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: Change fill attributes based on date SGPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Change-fill-attributes-based-on-date-SGPLOT/m-p/471721#M16282</link>
      <description>&lt;P&gt;Reeza's solution will work as well.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jun 2018 15:02:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Change-fill-attributes-based-on-date-SGPLOT/m-p/471721#M16282</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2018-06-20T15:02:49Z</dc:date>
    </item>
    <item>
      <title>Re: Change fill attributes based on date SGPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Change-fill-attributes-based-on-date-SGPLOT/m-p/471940#M16297</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt; and&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15130"&gt;@DanH_sas&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The I'm now trying to change the colour of the bars but not quit there. I'm trying to use a attrid.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As your example I added the 'group' in the data step.&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;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Attrmap;
	input group $ fillcolor $8.;
	datalines;
	0 beige
	1 pink
	;
RUN;

Proc SGPLOT data=work.Test noborder noautolegend dattrmap=attrmap;
	Title "Test";
	VBAR Date / RESPONSE=Resul group=group attrid=group;
	yaxis display=(noline noticks) Label="mm:ss";
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dean&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jun 2018 23:22:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Change-fill-attributes-based-on-date-SGPLOT/m-p/471940#M16297</guid>
      <dc:creator>DME790</dc:creator>
      <dc:date>2018-06-20T23:22:17Z</dc:date>
    </item>
    <item>
      <title>Re: Change fill attributes based on date SGPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Change-fill-attributes-based-on-date-SGPLOT/m-p/472100#M16302</link>
      <description>&lt;P&gt;The column you called "group" in the attrmap must be called "value". It's a reserved column name for the column that contains the values to map. Also, you need the "ID"&amp;nbsp; column to contain the ID referenced from the plot statement. We do it this way because you can have multiple attrmaps in the same data set. Your code should look something like this:&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";  /* or whatever you want to call the map */
	input value $ fillcolor $8.;
	datalines;
	0 beige
	1 pink
	;
RUN;

Proc SGPLOT data=work.Test noborder noautolegend dattrmap=attrmap;
	Title "Test";
	VBAR Date / RESPONSE=Resul group=group attrid=myid;
	yaxis display=(noline noticks) Label="mm:ss";
RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Jun 2018 14:00:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Change-fill-attributes-based-on-date-SGPLOT/m-p/472100#M16302</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2018-06-21T14:00:00Z</dc:date>
    </item>
  </channel>
</rss>

