<?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 color cells in proc report if value greater than fix value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/color-cells-in-proc-report-if-value-greater-than-fix-value/m-p/960446#M374585</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I want to color in red the cells with value greater than&amp;nbsp; 28 in&amp;nbsp; 3 fields:&amp;nbsp;&lt;CODE class=" language-sas"&gt;EXPD   RCVD   RCVD_ALL&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;what&amp;nbsp;is&amp;nbsp;the&amp;nbsp;way&amp;nbsp;to&amp;nbsp;do&amp;nbsp;it&amp;nbsp;please via proc report?&lt;/CODE&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data test;
input WD DAY $ EXPD RCVD RCVD_ALL NEWC $;                                                                                                                 
cards;    
-1 31JUL 29 49 56 Y
01 3AUG 26 26 77 Y
02 4AUG 77 45 0 N
03 5AUG 71 0 0 N
04 6AUG 44 0 0 N
;
RUN;

proc report data=TEST  nowd;
	column WD DAY EXPD RCVD RCVD_ALL;
	define WD / 'Working Day' display ;
	define DAY / ' Day' display;
	define EXPD / display;
	define RCVD / display;
	define RCVD_ALL / display;
	define NEWC/display;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 27 Feb 2025 19:00:13 GMT</pubDate>
    <dc:creator>Ronein</dc:creator>
    <dc:date>2025-02-27T19:00:13Z</dc:date>
    <item>
      <title>color cells in proc report if value greater than fix value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/color-cells-in-proc-report-if-value-greater-than-fix-value/m-p/960446#M374585</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I want to color in red the cells with value greater than&amp;nbsp; 28 in&amp;nbsp; 3 fields:&amp;nbsp;&lt;CODE class=" language-sas"&gt;EXPD   RCVD   RCVD_ALL&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;what&amp;nbsp;is&amp;nbsp;the&amp;nbsp;way&amp;nbsp;to&amp;nbsp;do&amp;nbsp;it&amp;nbsp;please via proc report?&lt;/CODE&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data test;
input WD DAY $ EXPD RCVD RCVD_ALL NEWC $;                                                                                                                 
cards;    
-1 31JUL 29 49 56 Y
01 3AUG 26 26 77 Y
02 4AUG 77 45 0 N
03 5AUG 71 0 0 N
04 6AUG 44 0 0 N
;
RUN;

proc report data=TEST  nowd;
	column WD DAY EXPD RCVD RCVD_ALL;
	define WD / 'Working Day' display ;
	define DAY / ' Day' display;
	define EXPD / display;
	define RCVD / display;
	define RCVD_ALL / display;
	define NEWC/display;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Feb 2025 19:00:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/color-cells-in-proc-report-if-value-greater-than-fix-value/m-p/960446#M374585</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2025-02-27T19:00:13Z</dc:date>
    </item>
    <item>
      <title>Re: color cells in proc report if value greater than fix value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/color-cells-in-proc-report-if-value-greater-than-fix-value/m-p/960466#M374590</link>
      <description>&lt;P&gt;You can do something like this example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data test; &lt;BR /&gt;input WD DAY $ EXPD RCVD RCVD_ALL NEWC $; &lt;BR /&gt;cards; &lt;BR /&gt;-1 31JUL 29 49 56 Y &lt;BR /&gt;01 3AUG 26 26 77 Y &lt;BR /&gt;02 4AUG 77 45 0 N &lt;BR /&gt;03 5AUG 71 0 0 N &lt;BR /&gt;04 6AUG 44 0 0 N &lt;BR /&gt;; &lt;BR /&gt;RUN; &lt;BR /&gt;&lt;BR /&gt;ods listing close; &lt;BR /&gt;ods html file='c:\temp\test.html'; &lt;BR /&gt;proc report data=TEST nowd; &lt;BR /&gt;column WD DAY EXPD RCVD RCVD_ALL newc; &lt;BR /&gt;define WD / 'Working Day' display ; &lt;BR /&gt;define DAY / ' Day' display; &lt;BR /&gt;define EXPD / display; &lt;BR /&gt;define RCVD / display; &lt;BR /&gt;define RCVD_ALL / display; &lt;BR /&gt;define NEWC/display; &lt;BR /&gt;&lt;BR /&gt;compute expd; &lt;BR /&gt;if expd &amp;gt; 28 then call define(_col_,"style","style=[background=red]"); &lt;BR /&gt;endcomp; &lt;BR /&gt;&lt;BR /&gt;quit; &lt;BR /&gt;ods html close; &lt;BR /&gt;ods listing; &lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2025 21:14:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/color-cells-in-proc-report-if-value-greater-than-fix-value/m-p/960466#M374590</guid>
      <dc:creator>russt_sas</dc:creator>
      <dc:date>2025-02-27T21:14:39Z</dc:date>
    </item>
    <item>
      <title>Re: color cells in proc report if value greater than fix value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/color-cells-in-proc-report-if-value-greater-than-fix-value/m-p/960477#M374599</link>
      <description>&lt;P&gt;Another approach that may be easier if many variables will have the &lt;STRONG&gt;exact same&lt;/STRONG&gt; coloring rule(s) would be a custom format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Proc format ;
value highlight_28_
28&amp;lt;-high = 'red'
;

proc report data=TEST  nowd;
	column WD DAY EXPD RCVD RCVD_ALL;
	define WD / 'Working Day' display ;
	define DAY / ' Day' display;
	define EXPD / display style=[background=highlight_28_.];
	define RCVD / display style=[background=highlight_28_.];
	define RCVD_ALL / display style=[background=highlight_28_.];
	define NEWC/display;
quit;
&lt;/PRE&gt;
&lt;P&gt;I named the format for the single value you referenced in the request just as a reminder.&lt;/P&gt;
&lt;P&gt;The advantage of a Format besides the single style reference is that the logic for the boundaries is moved out of the Proc Report and you need not write a bunch of if/then/else compute blocks. The logic in numeric formats is also a bit simpler - read the documentation.&lt;/P&gt;
&lt;P&gt;The format also will allow multiple ranges easily.&lt;/P&gt;
&lt;P&gt;If the boss changes, or wants a "what if we change the boundary value from X to Y" then you only need to change the format definition.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Character values can also be used in formats but ranges seldom do what is desired easily but a format to highlight values of NEWC could be provided. Note that since your Proc Report Column statement doesn't include NEWC there is a warning and nothing displayed in the result.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2025 23:24:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/color-cells-in-proc-report-if-value-greater-than-fix-value/m-p/960477#M374599</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2025-02-27T23:24:50Z</dc:date>
    </item>
  </channel>
</rss>

