<?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: Define Color Legend Range proc sgplot in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Define-Color-Legend-Range-proc-sgplot/m-p/771685#M22066</link>
    <description>&lt;P&gt;I think you would benefit from this example: &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/grstatproc/n1fxl54aizx1tjn1nfder5bsqqco.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/grstatproc/n1fxl54aizx1tjn1nfder5bsqqco.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is an RATTRMAP example where you provide an additional data set that maps the value ranges to color ranges.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Probably your "map" would provide ranges with a minimum and maximum value pair that maps to a specific range of Colormodel 1 to 2 .&lt;/P&gt;
&lt;P&gt;I would look at color ranges like:&lt;/P&gt;
&lt;P&gt;min max colormodel1&amp;nbsp;&amp;nbsp; colormodel2&lt;/P&gt;
&lt;P&gt;_min_&amp;nbsp; 30 red&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; orange&lt;/P&gt;
&lt;P&gt;30&amp;nbsp;&amp;nbsp; 60&amp;nbsp;&amp;nbsp;&amp;nbsp; orange&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yellow&lt;/P&gt;
&lt;P&gt;60&amp;nbsp; 100&amp;nbsp; yellow&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; green&lt;/P&gt;</description>
    <pubDate>Fri, 01 Oct 2021 20:12:28 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-10-01T20:12:28Z</dc:date>
    <item>
      <title>Define Color Legend Range proc sgplot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Define-Color-Legend-Range-proc-sgplot/m-p/771678#M22064</link>
      <description>&lt;P&gt;I am attempting to create a colored bar chart showing the percentage (from 0% to 100%) of employees who have completed their hours for the year. The report is produced monthly so as the months progress the bars should grow. I would like the colors to go from red (0%) to green (100%). Currently the colors range from red(0%) the the maximum value. With this method the range of values colored would change each month instead of being a static 0-100%. Below is table, script, and graph. Is there anyway to define the color range?&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="jacupp711_0-1633117176159.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64303iF9BF4D230E9471E8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jacupp711_0-1633117176159.png" alt="jacupp711_0-1633117176159.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods graphics / reset width=6in height=4in;
title '% Complete Minimum Credit2';
proc sgplot data=fleet_comp2 nowall noborder;
vbar report_ac / response=perc_comp nostatlabel 
				colorresponse=perc2 colormodel=(red yellow green) barwidth=1;
xaxis display=(nolabel);
yaxis values=(0 to 1 by .1) display=(nolabel) grid;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jacupp711_1-1633117206752.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64304i358155438ED4B018/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jacupp711_1-1633117206752.png" alt="jacupp711_1-1633117206752.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Oct 2021 19:40:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Define-Color-Legend-Range-proc-sgplot/m-p/771678#M22064</guid>
      <dc:creator>jacupp711</dc:creator>
      <dc:date>2021-10-01T19:40:14Z</dc:date>
    </item>
    <item>
      <title>Re: Define Color Legend Range proc sgplot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Define-Color-Legend-Range-proc-sgplot/m-p/771685#M22066</link>
      <description>&lt;P&gt;I think you would benefit from this example: &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/grstatproc/n1fxl54aizx1tjn1nfder5bsqqco.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/grstatproc/n1fxl54aizx1tjn1nfder5bsqqco.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is an RATTRMAP example where you provide an additional data set that maps the value ranges to color ranges.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Probably your "map" would provide ranges with a minimum and maximum value pair that maps to a specific range of Colormodel 1 to 2 .&lt;/P&gt;
&lt;P&gt;I would look at color ranges like:&lt;/P&gt;
&lt;P&gt;min max colormodel1&amp;nbsp;&amp;nbsp; colormodel2&lt;/P&gt;
&lt;P&gt;_min_&amp;nbsp; 30 red&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; orange&lt;/P&gt;
&lt;P&gt;30&amp;nbsp;&amp;nbsp; 60&amp;nbsp;&amp;nbsp;&amp;nbsp; orange&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yellow&lt;/P&gt;
&lt;P&gt;60&amp;nbsp; 100&amp;nbsp; yellow&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; green&lt;/P&gt;</description>
      <pubDate>Fri, 01 Oct 2021 20:12:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Define-Color-Legend-Range-proc-sgplot/m-p/771685#M22066</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-10-01T20:12:28Z</dc:date>
    </item>
    <item>
      <title>Re: Define Color Legend Range proc sgplot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Define-Color-Legend-Range-proc-sgplot/m-p/771769#M22068</link>
      <description>&lt;P&gt;You want this ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc freq data=sashelp.class noprint;
table age/out=have;
run;
ods graphics/reset=all;
proc template;
  define statgraph cal_heatmap;
    begingraph ;
	  entrytitle "xxxxxxxxxx";
	  rangeattrmap name="rmap";
        range 0- 100 / rangecolormodel=(green yellow red);		

	  endrangeattrmap;
	  rangeattrvar attrmap="rmap" attrvar=cvar var=percent;
	  layout overlay ;
	    BARCHARTPARM category=age response=percent / FILLTYPE=solid
	    colorresponse=cvar orient=horizontal name="heatmap" ;

		continuouslegend "heatmap" ;
	  endlayout;
	endgraph;
  end;
run;

proc sgrender data=have template=cal_heatmap;
run;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="x.png" style="width: 640px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64320i2733BFF8F017BB14/image-size/large?v=v2&amp;amp;px=999" role="button" title="x.png" alt="x.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Oct 2021 16:27:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Define-Color-Legend-Range-proc-sgplot/m-p/771769#M22068</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-10-02T16:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: Define Color Legend Range proc sgplot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Define-Color-Legend-Range-proc-sgplot/m-p/771908#M22071</link>
      <description>&lt;P&gt;Here's some sample code using the rattrmap (range attribute map) solution&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;recommended:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data fleet_comp2;
length report_ac $3;
format perc_comp perc2 percentn7.2;
input report_ac perc_comp;
perc2=perc_comp;
datalines;
220 .1282
320 .0366
350 .5652
717 .2143
73N .1587
7ER .6269
;
run;

data myrattrmap;
length min max $5 color $30;
input min max color;
id="myID";
datalines;
0 .1 cxa50026
.1 .2 cxd73027
.2 .3 cxf46d43
.3 .4 cxfdae61
.4 .5 cxfee08b
.5 .6 cxd9ef8b
.6 .7 cxa6d96a
.7 .8 cx66bd63
.8 .9 cx1a9850
.9 1 cx006837
;
run;

proc sgplot data=fleet_comp2 nowall noborder rattrmap=myrattrmap;
vbar report_ac / response=perc_comp nostatlabel barwidth=1
				colorresponse=perc2 rattrid=myID;
xaxis display=(nolabel);
yaxis values=(0 to 1 by .1) display=(nolabel) grid;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rattrmap.png" style="width: 640px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64343i8E89DE4B1345E73E/image-size/large?v=v2&amp;amp;px=999" role="button" title="rattrmap.png" alt="rattrmap.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Oct 2021 11:26:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Define-Color-Legend-Range-proc-sgplot/m-p/771908#M22071</guid>
      <dc:creator>GraphGuy</dc:creator>
      <dc:date>2021-10-04T11:26:32Z</dc:date>
    </item>
  </channel>
</rss>

