<?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: Coloring Report Columns using Proc Tabulate in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Coloring-Report-Columns-using-Proc-Tabulate/m-p/786455#M251105</link>
    <description>&lt;P&gt;Sorry. I can't help you . Maybe&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13549"&gt;@Cynthia_sas&lt;/a&gt;&amp;nbsp; know the solution ?&lt;/P&gt;
&lt;P&gt;Here is PROC REPORT code for your question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input name$ Sport$ Status$ cnt;
datalines;
Berlin running win 10
Berlin running lose 10
Berlin running tied 10
Mainz running win 20
Mainz running lose 20
Berlin soccer win 5
Berlin soccer lose 6
Berlin soccer tied 7
Mainz soccer win 8
Mainz soccer tied 9
Berlin swimming win 10
Berlin swimming lose 8
Berlin swimming tied 9
Mainz swimming win 11
Mainz swimming lose 15
Mainz swimming tied 2
;run;

PROC FORMAT;
VALUE $COLOR
'running'='lightorange'
'soccer'='lightgreen'
'swimming'='yellow';
RUN;


data test;
length name $ 80;
 set test;
 cnt1=cnt; cnt2=cnt;cnt3=cnt;cnt4=cnt;
 if Sport='running' then new_Status1=Status; else do;new_Status1='dummy';cnt1=.;end;
 if Sport='soccer'  then new_Status2=Status; else do;new_Status2='dummy';cnt2=.;end;
 if Sport='swimming' then new_Status3=Status;else do;new_Status3='dummy';cnt3=.;end;
run;



options missing='0';
proc report data=test nowd out=temp;
column name cnt1,Sport,new_Status1 cnt2,Sport,new_Status2 cnt3,Sport,new_Status3   cnt,Status  cnt4 ;  
define name/group style=header '';
define Sport/across '' style={background=$COLOR.};

define new_Status1/across nozero '' style={background=lightorange};
define new_Status2/across nozero '' style={background=lightgreen};
define new_Status3/across nozero '' style={background=yellow};
define Status/across nozero '' ;

define cnt1/analysis sum '' style={background=lightorange};
define cnt2/analysis sum '' style={background=lightgreen};
define cnt3/analysis sum '' style={background=yellow};
define cnt/analysis sum 'Total' style(column)={background=lightgrey};
define cnt4/analysis sum 'Each Person Total' style(column)={background=lightyellow} ;

compute cnt4;
if _BREAK_='_RBREAK_' then do;
  name='Grand Total';
  call define(_row_,'style','style=header{background=lightred}');
end;
endcomp;
rbreak after /summarize ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1639746098193.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66822i69567FD624DFB0DC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1639746098193.png" alt="Ksharp_0-1639746098193.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 17 Dec 2021 13:01:58 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2021-12-17T13:01:58Z</dc:date>
    <item>
      <title>Coloring Report Columns using Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Coloring-Report-Columns-using-Proc-Tabulate/m-p/785677#M250779</link>
      <description>&lt;P&gt;Hi. I'm trying to create this report view using Proc Tabulate, but I cannot apply color on the first row to the bottom of the table. Can you please advise what's wrong with my code? Thank you so much in advance!&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Sample Data&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;data test;&lt;BR /&gt;input name$ Sport$ Status$ cnt;&lt;BR /&gt;datalines;&lt;BR /&gt;Berlin running win 10&lt;BR /&gt;Berlin running lose 10&lt;BR /&gt;Berlin running tied 10&lt;BR /&gt;Mainz running win 20&lt;BR /&gt;Mainz running lose 20&lt;BR /&gt;Berlin soccer win 5&lt;BR /&gt;Berlin soccer lose 6&lt;BR /&gt;Berlin soccer tied 7&lt;BR /&gt;Mainz soccer win 8&lt;BR /&gt;Mainz soccer tied 9&lt;BR /&gt;Berlin swimming win 10&lt;BR /&gt;Berlin swimming lose 8&lt;BR /&gt;Berlin swimming tied 9&lt;BR /&gt;Mainz swimming win 11&lt;BR /&gt;Mainz swimming lose 15&lt;BR /&gt;Mainz swimming tied 2&lt;BR /&gt;;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Goal:&lt;/STRONG&gt;&lt;/U&gt; apply different color on each sport block&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="eduong58_0-1639370359363.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66675i8F44382C7D1A65B7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="eduong58_0-1639370359363.png" alt="eduong58_0-1639370359363.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;what I have now:&lt;/STRONG&gt;&lt;/U&gt; the color only apply on sport cell. I think I might put the&amp;nbsp;&lt;STRONG&gt;style=&amp;lt;parent&amp;gt; &lt;/STRONG&gt;in the wrong place.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="eduong58_2-1639370677161.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66677i7439BE5E0193FF54/image-size/medium?v=v2&amp;amp;px=400" role="button" title="eduong58_2-1639370677161.png" alt="eduong58_2-1639370677161.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;here is my code:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;PROC FORMAT;&lt;BR /&gt;VALUE $COLOR&lt;BR /&gt;'running'='lightorange'&lt;BR /&gt;'soccer'='lightgreen'&lt;BR /&gt;'swimming'='yellow';&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;proc tabulate data=test ;&lt;BR /&gt;class name Sport Status ;&lt;BR /&gt;classlev Sport / s=[background=$COLOR.];&lt;BR /&gt;classlev Status /style=&amp;lt;parent&amp;gt;;&lt;BR /&gt;var cnt / style=&amp;lt;parent&amp;gt;;&lt;BR /&gt;keyword sum / style=&amp;lt;parent&amp;gt;;&lt;BR /&gt;keylabel sum=' ';&lt;BR /&gt;table name=' ',Sport = ' '*Status=' '*cnt=' '*&lt;BR /&gt;{style=&amp;lt;parent&amp;gt; {foreground=black}}&lt;BR /&gt;;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Dec 2021 04:45:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Coloring-Report-Columns-using-Proc-Tabulate/m-p/785677#M250779</guid>
      <dc:creator>eduong58</dc:creator>
      <dc:date>2021-12-13T04:45:41Z</dc:date>
    </item>
    <item>
      <title>Re: Coloring Report Columns using Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Coloring-Report-Columns-using-Proc-Tabulate/m-p/785740#M250792</link>
      <description>&lt;P&gt;That is really uneasy. Maybe&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13549"&gt;@Cynthia_sas&lt;/a&gt;&amp;nbsp; could give you a short cut !&lt;/P&gt;
&lt;P&gt;And what destination you want to use ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data test;
input name$ Sport$ Status$ cnt;
datalines;
Berlin running win 10
Berlin running lose 10
Berlin running tied 10
Mainz running win 20
Mainz running lose 20
Berlin soccer win 5
Berlin soccer lose 6
Berlin soccer tied 7
Mainz soccer win 8
Mainz soccer tied 9
Berlin swimming win 10
Berlin swimming lose 8
Berlin swimming tied 9
Mainz swimming win 11
Mainz swimming lose 15
Mainz swimming tied 2
;run;

PROC FORMAT;
VALUE $COLOR
'running'='lightorange'
'soccer'='lightgreen'
'swimming'='yellow';
RUN;


data test;
 set test;
 length new_Status $ 200;
 if Sport='running' then new_Status=cats('(*ESC*)S={background=lightorange}',Status);
 if Sport='soccer' then new_Status=cats('(*ESC*)S={background=lightgreen}',Status);
 if Sport='swimming' then new_Status=cats('(*ESC*)S={background=yellow}',Status);
run;


ods rtf file='c:\temp\temp.rtf' bodytitle ;
options missing='0';
proc report data=test nowd out=temp;
column name cnt,Sport,new_Status;
define name/group;
define Sport/across ' ' style={background=$COLOR.};
define new_Status/across nozero ' ';
define cnt/analysis sum ' ';

compute cnt;
call define('_c5_','style','style={background=lightorange}');
call define('_c6_','style','style={background=lightorange}');
call define('_c7_','style','style={background=lightorange}');

call define('_c11_','style','style={background=lightgreen}');
call define('_c12_','style','style={background=lightgreen}');
call define('_c13_','style','style={background=lightgreen}');

call define('_c26_','style','style={background=yellow}');
call define('_c27_','style','style={background=yellow}');
call define('_c28_','style','style={background=yellow}');
endcomp;
run;
ods rtf close;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1639398799296.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66699i77D1D220DCECD809/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1639398799296.png" alt="Ksharp_0-1639398799296.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Dec 2021 12:33:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Coloring-Report-Columns-using-Proc-Tabulate/m-p/785740#M250792</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-12-13T12:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: Coloring Report Columns using Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Coloring-Report-Columns-using-Proc-Tabulate/m-p/785758#M250802</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;. Thank you for your reply. I want to print this report in email. I'm not sure if I can use "proc report" instead of "proc tabulate" since I want to add 2 extra Total columns at the report. Can you please advise if your way create these 2 Total columns? Here is the view of my report:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="eduong58_0-1639405060628.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66702iB8A073FBD92DBAC6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="eduong58_0-1639405060628.png" alt="eduong58_0-1639405060628.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Code I used: (exactly like the one i posted in question with 2 extra lines at the end)&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;proc tabulate data=test ;&lt;BR /&gt;class name Sport Status ;&lt;BR /&gt;classlev Sport / s=[background=$COLOR.];&lt;BR /&gt;classlev Status /style=&amp;lt;parent&amp;gt;;&lt;BR /&gt;var cnt / style=&amp;lt;parent&amp;gt;;&lt;BR /&gt;keyword sum / style=&amp;lt;parent&amp;gt;;&lt;BR /&gt;keylabel sum=' ';&lt;BR /&gt;table name=' ',Sport = ' '*Status=' '*cnt=' '* {style=&amp;lt;parent&amp;gt; {foreground=black}}&lt;BR /&gt;ALL=' ' * Status='Total' * {STYLE={BACKGROUND=lightgrey}} * cnt=' '&lt;BR /&gt;ALL='Each Person Total' * {STYLE={BACKGROUND=lightyellow}}* cnt=' '&lt;BR /&gt;;run;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Dec 2021 14:36:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Coloring-Report-Columns-using-Proc-Tabulate/m-p/785758#M250802</guid>
      <dc:creator>eduong58</dc:creator>
      <dc:date>2021-12-13T14:36:49Z</dc:date>
    </item>
    <item>
      <title>Re: Coloring Report Columns using Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Coloring-Report-Columns-using-Proc-Tabulate/m-p/785778#M250812</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; If you want the default TABULATE output using &amp;lt;parent&amp;gt; style overrides, it seems to me that you are doing a variation of the Retail/Wholesale example in this Tech Support note:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/kb/25/401.html" target="_blank"&gt;https://support.sas.com/kb/25/401.html&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;as shown below:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_0-1639411380278.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66703iA56C08807C1FD930/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_0-1639411380278.png" alt="Cynthia_sas_0-1639411380278.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The Full Code tab in the note has the code and data that created this example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Mon, 13 Dec 2021 16:03:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Coloring-Report-Columns-using-Proc-Tabulate/m-p/785778#M250812</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2021-12-13T16:03:38Z</dc:date>
    </item>
    <item>
      <title>Re: Coloring Report Columns using Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Coloring-Report-Columns-using-Proc-Tabulate/m-p/785973#M250886</link>
      <description>&lt;P&gt;It looks like&amp;nbsp; the solution posted by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13549"&gt;@Cynthia_sas&lt;/a&gt;&amp;nbsp; can't get your job done.&lt;/P&gt;
&lt;P&gt;Try this one :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input name$ Sport$ Status$ cnt;
datalines;
Berlin running win 10
Berlin running lose 10
Berlin running tied 10
Mainz running win 20
Mainz running lose 20
Berlin soccer win 5
Berlin soccer lose 6
Berlin soccer tied 7
Mainz soccer win 8
Mainz soccer tied 9
Berlin swimming win 10
Berlin swimming lose 8
Berlin swimming tied 9
Mainz swimming win 11
Mainz swimming lose 15
Mainz swimming tied 2
;run;

PROC FORMAT;
VALUE $COLOR
'running'='lightorange'
'soccer'='lightgreen'
'swimming'='yellow';
RUN;


data test;
 set test;
 cnt1=cnt; cnt2=cnt;cnt3=cnt;cnt4=cnt;
 if Sport='running' then new_Status1=Status; else do;new_Status1='dummy';cnt1=.;end;
 if Sport='soccer'  then new_Status2=Status; else do;new_Status2='dummy';cnt2=.;end;
 if Sport='swimming' then new_Status3=Status;else do;new_Status3='dummy';cnt3=.;end;
run;



options missing='0';
proc report data=test nowd out=temp;
column name cnt1,Sport,new_Status1 cnt2,Sport,new_Status2 cnt3,Sport,new_Status3   cnt,Status  cnt4 ;  
define name/group;
define Sport/across '' style={background=$COLOR.};

define new_Status1/across nozero '' style={background=lightorange};
define new_Status2/across nozero '' style={background=lightgreen};
define new_Status3/across nozero '' style={background=yellow};
define Status/across nozero '' style={background=red};

define cnt1/analysis sum '' style={background=lightorange};
define cnt2/analysis sum '' style={background=lightgreen};
define cnt3/analysis sum '' style={background=yellow};
define cnt/analysis sum 'Total' style={background=red} ;
define cnt4/analysis sum 'Each Person Total' ;

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1639482007786.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66749iC525B4EE7009898B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1639482007786.png" alt="Ksharp_0-1639482007786.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 11:40:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Coloring-Report-Columns-using-Proc-Tabulate/m-p/785973#M250886</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-12-14T11:40:16Z</dc:date>
    </item>
    <item>
      <title>Re: Coloring Report Columns using Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Coloring-Report-Columns-using-Proc-Tabulate/m-p/786065#M250925</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Not so fast &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;!&amp;nbsp;The code in the solution I posted DOES work, as shown below:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_0-1639518491368.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66756i8B4BD6C36033CB89/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_0-1639518491368.png" alt="Cynthia_sas_0-1639518491368.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Even if you blank out the header for the STATUS variable the CLASS statement for STATUS still needs to inherit from the parent cells above it. So the CLASS statement that I added to the original code, works as advertised in the Tech Support note. PROC REPORT is great, but not necessary, in this instance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 21:50:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Coloring-Report-Columns-using-Proc-Tabulate/m-p/786065#M250925</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2021-12-14T21:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: Coloring Report Columns using Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Coloring-Report-Columns-using-Proc-Tabulate/m-p/786150#M250967</link>
      <description>&lt;P&gt;It is awesome. And glad to see it is working .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input name$ Sport$ Status$ cnt;
datalines;
Berlin running win 10
Berlin running lose 10
Berlin running tied 10
Mainz running win 20
Mainz running lose 20
Berlin soccer win 5
Berlin soccer lose 6
Berlin soccer tied 7
Mainz soccer win 8
Mainz soccer tied 9
Berlin swimming win 10
Berlin swimming lose 8
Berlin swimming tied 9
Mainz swimming win 11
Mainz swimming lose 15
Mainz swimming tied 2
;run;

PROC FORMAT;
VALUE $COLOR
'running'='lightorange'
'soccer'='lightgreen'
'swimming'='yellow';
RUN;

proc tabulate data=test ;
class name Sport Status / style=&amp;lt;parent&amp;gt;;

classlev Sport / s=[background=$COLOR.];
classlev Status /style=&amp;lt;parent&amp;gt;;
var cnt / style=&amp;lt;parent&amp;gt;;
keyword sum / style=&amp;lt;parent&amp;gt;;
keylabel sum=' ';
table name=' ',Sport = ' '*Status=' '*cnt=' '* {style=&amp;lt;parent&amp;gt; {foreground=black}}
ALL=' ' * Status='Total' * {STYLE={BACKGROUND=lightgrey}} * cnt=' '
ALL='Each Person Total' * {STYLE={BACKGROUND=lightyellow}}* cnt=' '
;run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1639569147355.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66774iFF57274814014E86/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1639569147355.png" alt="Ksharp_0-1639569147355.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Dec 2021 11:52:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Coloring-Report-Columns-using-Proc-Tabulate/m-p/786150#M250967</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-12-15T11:52:35Z</dc:date>
    </item>
    <item>
      <title>Re: Coloring Report Columns using Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Coloring-Report-Columns-using-Proc-Tabulate/m-p/786408#M251087</link>
      <description>&lt;P&gt;Thank you so much for you two help&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13549"&gt;@Cynthia_sas&lt;/a&gt;&amp;nbsp;!!! It works perfectly &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Also, I want to add the&lt;STRONG&gt; Grand Total&lt;/STRONG&gt; row at the end of the report, and want to apply&lt;FONT color="#FF6600"&gt;&amp;nbsp;the background RED&lt;/FONT&gt; color across the table. I'm not sure if its possible to overwrite the color we assigned for Sport or not.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="eduong58_0-1639700794049.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66811iE91867598BD737DF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="eduong58_0-1639700794049.png" alt="eduong58_0-1639700794049.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;here is the new piece that I added to the code but does not work:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;PROC FORMAT;&lt;BR /&gt;VALUE $COLOR&lt;BR /&gt;'running'='lightorange'&lt;BR /&gt;'soccer'='lightgreen'&lt;BR /&gt;'swimming'='yellow';&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;proc tabulate data=test ;&lt;BR /&gt;class name Sport Status / style=&amp;lt;parent&amp;gt;;&lt;BR /&gt;classlev Sport / s=[background=$COLOR.];&lt;BR /&gt;classlev Status /style=&amp;lt;parent&amp;gt;;&lt;BR /&gt;var cnt / style=&amp;lt;parent&amp;gt;;&lt;BR /&gt;keyword sum / style=&amp;lt;parent&amp;gt;;&lt;BR /&gt;keylabel sum=' ';&lt;/P&gt;&lt;P&gt;table name=' ' &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;ALL='Grand Total' * {STYLE={BACKGROUND=lightred}}&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;,&lt;BR /&gt;Sport = ' '*Status=' '*cnt=' '* {style=&amp;lt;parent&amp;gt; {foreground=black}}&lt;BR /&gt;ALL=' ' * Status='Total' * {STYLE={BACKGROUND=lightgrey}} * cnt=' '&lt;BR /&gt;ALL='Each Person Total' * {STYLE={BACKGROUND=lightyellow}}* cnt=' '&lt;/P&gt;&lt;P&gt;;run;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Dec 2021 00:30:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Coloring-Report-Columns-using-Proc-Tabulate/m-p/786408#M251087</guid>
      <dc:creator>eduong58</dc:creator>
      <dc:date>2021-12-17T00:30:19Z</dc:date>
    </item>
    <item>
      <title>Re: Coloring Report Columns using Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Coloring-Report-Columns-using-Proc-Tabulate/m-p/786455#M251105</link>
      <description>&lt;P&gt;Sorry. I can't help you . Maybe&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13549"&gt;@Cynthia_sas&lt;/a&gt;&amp;nbsp; know the solution ?&lt;/P&gt;
&lt;P&gt;Here is PROC REPORT code for your question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input name$ Sport$ Status$ cnt;
datalines;
Berlin running win 10
Berlin running lose 10
Berlin running tied 10
Mainz running win 20
Mainz running lose 20
Berlin soccer win 5
Berlin soccer lose 6
Berlin soccer tied 7
Mainz soccer win 8
Mainz soccer tied 9
Berlin swimming win 10
Berlin swimming lose 8
Berlin swimming tied 9
Mainz swimming win 11
Mainz swimming lose 15
Mainz swimming tied 2
;run;

PROC FORMAT;
VALUE $COLOR
'running'='lightorange'
'soccer'='lightgreen'
'swimming'='yellow';
RUN;


data test;
length name $ 80;
 set test;
 cnt1=cnt; cnt2=cnt;cnt3=cnt;cnt4=cnt;
 if Sport='running' then new_Status1=Status; else do;new_Status1='dummy';cnt1=.;end;
 if Sport='soccer'  then new_Status2=Status; else do;new_Status2='dummy';cnt2=.;end;
 if Sport='swimming' then new_Status3=Status;else do;new_Status3='dummy';cnt3=.;end;
run;



options missing='0';
proc report data=test nowd out=temp;
column name cnt1,Sport,new_Status1 cnt2,Sport,new_Status2 cnt3,Sport,new_Status3   cnt,Status  cnt4 ;  
define name/group style=header '';
define Sport/across '' style={background=$COLOR.};

define new_Status1/across nozero '' style={background=lightorange};
define new_Status2/across nozero '' style={background=lightgreen};
define new_Status3/across nozero '' style={background=yellow};
define Status/across nozero '' ;

define cnt1/analysis sum '' style={background=lightorange};
define cnt2/analysis sum '' style={background=lightgreen};
define cnt3/analysis sum '' style={background=yellow};
define cnt/analysis sum 'Total' style(column)={background=lightgrey};
define cnt4/analysis sum 'Each Person Total' style(column)={background=lightyellow} ;

compute cnt4;
if _BREAK_='_RBREAK_' then do;
  name='Grand Total';
  call define(_row_,'style','style=header{background=lightred}');
end;
endcomp;
rbreak after /summarize ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1639746098193.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66822i69567FD624DFB0DC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1639746098193.png" alt="Ksharp_0-1639746098193.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Dec 2021 13:01:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Coloring-Report-Columns-using-Proc-Tabulate/m-p/786455#M251105</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-12-17T13:01:58Z</dc:date>
    </item>
    <item>
      <title>Re: Coloring Report Columns using Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Coloring-Report-Columns-using-Proc-Tabulate/m-p/786533#M251149</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Using my test data and previous code, it was an easy modification, as shown below:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_0-1639761813227.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66833i1D3579FE1AB3C087/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_0-1639761813227.png" alt="Cynthia_sas_0-1639761813227.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;When you have the possibility of a "collision" of style override values, as would happen in the Grand Total row, then you need to add the style_precedence option on the TABLE statement, along with the 2 other style overrides.&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Fri, 17 Dec 2021 17:25:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Coloring-Report-Columns-using-Proc-Tabulate/m-p/786533#M251149</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2021-12-17T17:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: Coloring Report Columns using Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Coloring-Report-Columns-using-Proc-Tabulate/m-p/786596#M251177</link>
      <description>&lt;P&gt;Cynthia,&lt;/P&gt;
&lt;P&gt;When I using your code , I got this . Any idea ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input name$ Sport$ Status$ cnt;
datalines;
Berlin running win 10
Berlin running lose 10
Berlin running tied 10
Mainz running win 20
Mainz running lose 20
Berlin soccer win 5
Berlin soccer lose 6
Berlin soccer tied 7
Mainz soccer win 8
Mainz soccer tied 9
Berlin swimming win 10
Berlin swimming lose 8
Berlin swimming tied 9
Mainz swimming win 11
Mainz swimming lose 15
Mainz swimming tied 2
;run;

PROC FORMAT;
VALUE $COLOR
'running'='lightorange'
'soccer'='lightgreen'
'swimming'='yellow';
RUN;

proc tabulate data=test ;
class name Sport ;
class Status / style=&amp;lt;parent&amp;gt;;
classlev Sport / s=[background=$COLOR.];
classlev Status /style=&amp;lt;parent&amp;gt;;
var cnt / style=&amp;lt;parent&amp;gt;;
keyword sum / style=&amp;lt;parent&amp;gt;;
keylabel sum=' ';
keyword all/style={background=lightred};
table name=' ' ALL='Grand Total' * {STYLE={BACKGROUND=lightred}}
,
Sport = ' '*Status=' '*cnt=' '* {style=&amp;lt;parent&amp;gt; {foreground=black}}
ALL=' ' * Status='Total' * {STYLE={BACKGROUND=lightgrey}} * cnt=' '
ALL='Each Person Total' * {STYLE={BACKGROUND=lightyellow}}* cnt=' '
/style_precedence=row;
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1639831960587.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66845iE7ABDFD8FE933D9A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1639831960587.png" alt="Ksharp_0-1639831960587.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Dec 2021 12:53:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Coloring-Report-Columns-using-Proc-Tabulate/m-p/786596#M251177</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-12-18T12:53:05Z</dc:date>
    </item>
    <item>
      <title>Re: Coloring Report Columns using Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Coloring-Report-Columns-using-Proc-Tabulate/m-p/786685#M251217</link>
      <description>Hi:&lt;BR /&gt;  Your KEYWORD statement for ALL is coloring the last row and the ALL headers in the column dimension too.If you take out the KEYWORD statement, you'll still get the red cells on the grand total line, but the cell for Grand Total won't be red background. So, in that case, if controlling the ALL headers is critical, that may be a reason to move to PROC REPORT&amp;gt;&lt;BR /&gt;Cynthia</description>
      <pubDate>Mon, 20 Dec 2021 04:13:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Coloring-Report-Columns-using-Proc-Tabulate/m-p/786685#M251217</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2021-12-20T04:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: Coloring Report Columns using Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Coloring-Report-Columns-using-Proc-Tabulate/m-p/786727#M251232</link>
      <description>&lt;P&gt;Hi Cynthia,&lt;/P&gt;
&lt;P&gt;You mean PROC TABULATE as far as can do this ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input name$ Sport$ Status$ cnt;
datalines;
Berlin running win 10
Berlin running lose 10
Berlin running tied 10
Mainz running win 20
Mainz running lose 20
Berlin soccer win 5
Berlin soccer lose 6
Berlin soccer tied 7
Mainz soccer win 8
Mainz soccer tied 9
Berlin swimming win 10
Berlin swimming lose 8
Berlin swimming tied 9
Mainz swimming win 11
Mainz swimming lose 15
Mainz swimming tied 2
;run;

PROC FORMAT;
VALUE $COLOR
'running'='lightorange'
'soccer'='lightgreen'
'swimming'='yellow';

RUN;

proc tabulate data=test ;
class name Sport ;
class Status / style=&amp;lt;parent&amp;gt;;
classlev Sport / s=[background=$COLOR.];
classlev Status /style=&amp;lt;parent&amp;gt;;
var cnt / style=&amp;lt;parent&amp;gt;;
keyword sum / style=&amp;lt;parent&amp;gt;;
keylabel sum=' ';
*keyword all/style={background=lightred};
table name=' ' ALL='Grand Total' * {STYLE={BACKGROUND=lightred}}
,
Sport = ' '*Status=' '*cnt=' '* {style=&amp;lt;parent&amp;gt; {foreground=black}}
ALL=' ' * Status='Total' * {STYLE={BACKGROUND=lightgrey}} * cnt=' '
ALL='Each Person Total' * {STYLE={BACKGROUND=lightyellow}}* cnt=' '
/style_precedence=row;
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1640004805801.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66877i4F8B24223A45691B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1640004805801.png" alt="Ksharp_0-1640004805801.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Dec 2021 12:53:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Coloring-Report-Columns-using-Proc-Tabulate/m-p/786727#M251232</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-12-20T12:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: Coloring Report Columns using Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Coloring-Report-Columns-using-Proc-Tabulate/m-p/786792#M251253</link>
      <description>Hi:&lt;BR /&gt;  Yes, as you can see the cell with the Word "Grand Total" is not red background, but the data cells on the summary line are red. That also allows the column headers for Total and Each Person Total to be the default color for the ALL, too.&lt;BR /&gt;&lt;BR /&gt;Cynthia</description>
      <pubDate>Mon, 20 Dec 2021 17:39:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Coloring-Report-Columns-using-Proc-Tabulate/m-p/786792#M251253</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2021-12-20T17:39:19Z</dc:date>
    </item>
    <item>
      <title>Re: Coloring Report Columns using Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Coloring-Report-Columns-using-Proc-Tabulate/m-p/787044#M251391</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;, I got the same output with you since&amp;nbsp; I don't want to apply RED to other ALL columns.&amp;nbsp; So I added the separate style for Grand Total itself and it works.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc tabulate data=test ;&lt;BR /&gt;class name Sport ;&lt;BR /&gt;class Status / style=&amp;lt;parent&amp;gt;;&lt;BR /&gt;classlev Sport / s=[background=$COLOR.];&lt;BR /&gt;classlev Status /style=&amp;lt;parent&amp;gt;;&lt;BR /&gt;var cnt / style=&amp;lt;parent&amp;gt;;&lt;BR /&gt;keyword sum / style=&amp;lt;parent&amp;gt;;&lt;BR /&gt;keylabel sum=' ';&lt;BR /&gt;*keyword all/style={background=lightred};&lt;BR /&gt;table name=' ' &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;ALL={Label='Grand Total' style={BACKGROUND=lightred}} * {STYLE={BACKGROUND=lightred}}&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;,&lt;BR /&gt;Sport = ' '*Status=' '*cnt=' '* {style=&amp;lt;parent&amp;gt; {foreground=black}}&lt;BR /&gt;ALL=' ' * Status='Total' * {STYLE={BACKGROUND=lightgrey}} * cnt=' '&lt;BR /&gt;ALL='Each Person Total' * {STYLE={BACKGROUND=lightyellow}}* cnt=' '&lt;BR /&gt;/style_precedence=row;&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="eduong58_0-1640139834905.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66928iF9B5B56BF1426C03/image-size/medium?v=v2&amp;amp;px=400" role="button" title="eduong58_0-1640139834905.png" alt="eduong58_0-1640139834905.png" /&gt;&lt;/span&gt;&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, 22 Dec 2021 02:24:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Coloring-Report-Columns-using-Proc-Tabulate/m-p/787044#M251391</guid>
      <dc:creator>eduong58</dc:creator>
      <dc:date>2021-12-22T02:24:03Z</dc:date>
    </item>
    <item>
      <title>Re: Coloring Report Columns using Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Coloring-Report-Columns-using-Proc-Tabulate/m-p/787084#M251411</link>
      <description>Great! I event don't know the syntax in red within TABLE. &lt;BR /&gt;I only remember that it could be used  in BOX={lable='xx' style={...}}&lt;BR /&gt;Good to know something new .</description>
      <pubDate>Wed, 22 Dec 2021 11:53:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Coloring-Report-Columns-using-Proc-Tabulate/m-p/787084#M251411</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-12-22T11:53:08Z</dc:date>
    </item>
  </channel>
</rss>

