<?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 How to compare last row values with previous row and highlight its columns accordingly? in SAS Visual Analytics</title>
    <link>https://communities.sas.com/t5/SAS-Visual-Analytics/How-to-compare-last-row-values-with-previous-row-and-highlight/m-p/566511#M12616</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello! My data set looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data example;
input month $3. push_ups pull_ups dips;
cards;
JAN 10 10 10
FEB 12 15 10
MAR 14 17 8
APR 16 19 11
MAY 20 18 11
JUN 21 17 11
;
run;

title 'Some table' bold;
proc report data=example;
column month (push_ups pull_ups dips);

define month / group order=data 'Month';

define push_ups / display 'Push-ups';
define pull_ups / display 'Pull-ups';
define dips / display 'Dips';
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I.e. after each month I measure how many repetitions of each kind of exercise I can do and add results to the table. I want to do more repetitions every month for each exercise, but sometimes I fail. I'd want to highlight the column with green/snow/red depending on result of comparison of my result in last month and previous one. For example, in this data set I'd like to highlight first column with green, second - with red and third - with snow&amp;nbsp;(not to highlight it at all). I guess I can do it using COMPUTE statement, but I know only _RAW_ and _COL_, not _CELL_ parameters (I know also _VAL_, but I can't use it correctly in this situation and compare desired values). Maybe proc report not a right thing to use here, if so, I can use something else instead of it. My version of SAS is 9.4. Can someone help me or give a hint how to overcome this problem? Thanks in advance!&lt;/P&gt;</description>
    <pubDate>Mon, 17 Jun 2019 08:55:07 GMT</pubDate>
    <dc:creator>esko1779</dc:creator>
    <dc:date>2019-06-17T08:55:07Z</dc:date>
    <item>
      <title>How to compare last row values with previous row and highlight its columns accordingly?</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/How-to-compare-last-row-values-with-previous-row-and-highlight/m-p/566511#M12616</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello! My data set looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data example;
input month $3. push_ups pull_ups dips;
cards;
JAN 10 10 10
FEB 12 15 10
MAR 14 17 8
APR 16 19 11
MAY 20 18 11
JUN 21 17 11
;
run;

title 'Some table' bold;
proc report data=example;
column month (push_ups pull_ups dips);

define month / group order=data 'Month';

define push_ups / display 'Push-ups';
define pull_ups / display 'Pull-ups';
define dips / display 'Dips';
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I.e. after each month I measure how many repetitions of each kind of exercise I can do and add results to the table. I want to do more repetitions every month for each exercise, but sometimes I fail. I'd want to highlight the column with green/snow/red depending on result of comparison of my result in last month and previous one. For example, in this data set I'd like to highlight first column with green, second - with red and third - with snow&amp;nbsp;(not to highlight it at all). I guess I can do it using COMPUTE statement, but I know only _RAW_ and _COL_, not _CELL_ parameters (I know also _VAL_, but I can't use it correctly in this situation and compare desired values). Maybe proc report not a right thing to use here, if so, I can use something else instead of it. My version of SAS is 9.4. Can someone help me or give a hint how to overcome this problem? Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2019 08:55:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/How-to-compare-last-row-values-with-previous-row-and-highlight/m-p/566511#M12616</guid>
      <dc:creator>esko1779</dc:creator>
      <dc:date>2019-06-17T08:55:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare last row values with previous row and highlight its columns accordingly?</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/How-to-compare-last-row-values-with-previous-row-and-highlight/m-p/580739#M12912</link>
      <description>&lt;P&gt;Hi Esko,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1.Just let me know you want to highlight the complete column or the row with colors?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or&lt;/P&gt;
&lt;P&gt;2. You want to highlight based on the previous month comparison.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yeah, you are correct there are few computation we can do in Proc Report. I think you can have a check with the below links for better understanding related to proc report.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/resources/papers/proceedings/pdfs/sgf2008/224-2008.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings/pdfs/sgf2008/224-2008.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;title 'Some table' bold;
proc report data=example;
column month (push_ups pull_ups dips);

define month / group order=data 'Month';

define push_ups / display 'Push-ups';
define pull_ups / display 'Pull-ups';
define dips / display 'Dips';
/*if you want to apply color in complete row and pass the color code or name as per requirement*/
compute push_ups;
CALL DEFINE(_ROW_, "style", "STYLE=[BACKGROUD=HONEYDEW]"); 
endcomp;
/*if you want to apply color in complete column*/
compute pull_ups;
IF pull_ups &amp;gt; 10 then 
CALL DEFINE(_COL_, "style", "STYLE=[BACKGROUD=lightRED]"); 
endcomp;

COMPUTE dips; 
 CALL DEFINE("_c4_", "style","STYLE=[BACKGROUND=lightRED]"); 
endcomp;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Somehow you can code like the above code, if you need the alteration in Rows, columns, Cell level or conditional level.&lt;/P&gt;
&lt;P&gt;If any custom report you need which is by default not available with proc Report then I would suggest please prepare the data as per requirement may be with Data step or proc SQL Step, before using the dataset in proc report.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you can share the output sample format with colors, may be from Excel you can do that then I can attempt to resolve your query completely.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks and Gud luck.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2019 09:15:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/How-to-compare-last-row-values-with-previous-row-and-highlight/m-p/580739#M12912</guid>
      <dc:creator>rajdeep</dc:creator>
      <dc:date>2019-08-13T09:15:48Z</dc:date>
    </item>
  </channel>
</rss>

