<?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: Proc Tabulate Table output in Color? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Table-output-in-Color/m-p/906771#M358036</link>
    <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sample.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/90951i56F656625E04D861/image-size/large?v=v2&amp;amp;px=999" role="button" title="Sample.png" alt="Sample.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 07 Dec 2023 18:00:38 GMT</pubDate>
    <dc:creator>ybz12003</dc:creator>
    <dc:date>2023-12-07T18:00:38Z</dc:date>
    <item>
      <title>Proc Tabulate Table output in Color?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Table-output-in-Color/m-p/906709#M358014</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I'm wondering if there is a way to output a table in color by Proc Tabulate.&amp;nbsp; For example, I would like to have the "year" in different colors in the following code.&amp;nbsp; Is it doable?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc tabulate data=&amp;amp;Pathogen.;
  Class year state Quarter/ missing;
  var Test ;
  table State*(test*f=10.0),year;
  where Test__groups_ in ('&amp;gt;= 1');
  Label State="State" Test="Test Group &amp;gt;=1 counts";
  Title '&amp;amp;Pathogen._TestGrpLt1_count';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Dec 2023 14:37:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Table-output-in-Color/m-p/906709#M358014</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2023-12-07T14:37:34Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate Table output in Color?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Table-output-in-Color/m-p/906712#M358015</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc tabulate data=&amp;amp;Pathogen.;
  Class year state Quarter/ missing;
  var Test ;
  table State*(test*f=10.0),year*[style=[COLOR=RED]];
  where Test__groups_ in ('&amp;gt;= 1');
  Label State="State" Test="Test Group &amp;gt;=1 counts";
  Title '&amp;amp;Pathogen._TestGrpLt1_count';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;did you try something like "style=" ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Thu, 07 Dec 2023 14:48:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Table-output-in-Color/m-p/906712#M358015</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2023-12-07T14:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate Table output in Color?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Table-output-in-Color/m-p/906715#M358016</link>
      <description>Yes, but not all in RED.  I would like to get different colors in different years.</description>
      <pubDate>Thu, 07 Dec 2023 15:07:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Table-output-in-Color/m-p/906715#M358016</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2023-12-07T15:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate Table output in Color?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Table-output-in-Color/m-p/906716#M358017</link>
      <description>&lt;P&gt;you could try to use technique called "traffic lights", here is an example in proc report:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/resources/papers/proceedings11/290-2011.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings11/290-2011.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;but you can adopt it to tabulate too, which can be seen here:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/resources/papers/proceedings/proceedings/sugi31/142-31.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings/proceedings/sugi31/142-31.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Thu, 07 Dec 2023 15:16:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Table-output-in-Color/m-p/906716#M358017</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2023-12-07T15:16:48Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate Table output in Color?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Table-output-in-Color/m-p/906719#M358019</link>
      <description>&lt;P&gt;To assign colors based on the value of a variable create a custom format for the color you want and associate it with the variable/values you want.&lt;/P&gt;
&lt;P&gt;Example (that you can actually run because you should have the SASHELP.CLASS training data set)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;Proc format;
value $sex_color
'F'='lightred'
'M'='blue'
;
value agegrp
low-12='Preteen'
13-17 ='Teen'
;
value agecolor
low-12 = 'gold'
13-17  = 'red'
;
value  valcolor
low -&amp;lt;60 = 'darkgreen'
60 - high= 'cyan'
;
run;

proc tabulate data=sashelp.class;
   class sex age ;
   classlev sex /style=[color=$sex_color.];
   classlev age /style=[backgroundcolor=agecolor.];
   format age agegrp.;
   var height;
   table sex,
         age*height*mean*[style=[background=valcolor.]]
   ;
run;
&lt;/LI-CODE&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="ChrisHemedinger_0-1701965765173.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/90944i24E01231B500073F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChrisHemedinger_0-1701965765173.png" alt="ChrisHemedinger_0-1701965765173.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;SAS has multiple ways to designate color so is worth looking at the documentation depending on what you actually want.&lt;/P&gt;
&lt;P&gt;The formats a examples of how to assign colors and one text (agegrp) based on ranges of values or list of values .&lt;/P&gt;
&lt;P&gt;The CLASSLEV will allow you to assign properties to CLASS variables which can keep the actual table syntax a bit cleaner and is very helpful if you are using Proc tabulate to make more than one table with a single procedure call to keep everything set the same without having to duplicate it in the body of the table. Note the use of the Format name associated with the item to color. I show an example of both the text (Color=) and the cell background (backgroundcolor= ) color settings.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also an example of providing appearance change based on the result of a statistic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Dec 2023 16:17:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Table-output-in-Color/m-p/906719#M358019</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-12-07T16:17:46Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate Table output in Color?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Table-output-in-Color/m-p/906749#M358030</link>
      <description>It didn't work as I expected.  I would like to get the year result background shown in a different color, not just the title.</description>
      <pubDate>Thu, 07 Dec 2023 17:15:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Table-output-in-Color/m-p/906749#M358030</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2023-12-07T17:15:57Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate Table output in Color?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Table-output-in-Color/m-p/906750#M358031</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc format;
value year color
2021 = 'lighttan'
2022  = 'lightpink'
2023  = 'lightblue'
;
run;

proc tabulate data=&amp;amp;Pathogen.;
  Class year state Quarter/ missing;
  classlev year /style=[backgroundcolor=yearcolor.];
  var Positive Test ;
  table State*(positive*f=10.0*[style=olive] test*f=10.0),year*[style=[background=yearcolor.]]*(quarter all);
  Label State="State" Positive="Total Positive counts" Test="Total Test counts";
  Title '&amp;amp;Pathogen._test#_sum';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Please let me know where I should modify my code.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Dec 2023 17:37:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Table-output-in-Color/m-p/906750#M358031</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2023-12-07T17:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate Table output in Color?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Table-output-in-Color/m-p/906764#M358034</link>
      <description>Start by fixing errors indicated in the log (proc format)&lt;BR /&gt;</description>
      <pubDate>Thu, 07 Dec 2023 17:43:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Table-output-in-Color/m-p/906764#M358034</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-12-07T17:43:37Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate Table output in Color?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Table-output-in-Color/m-p/906766#M358035</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc format;
value&lt;FONT size="5" color="#FF0000"&gt;&lt;STRONG&gt; year color&lt;/STRONG&gt;&lt;/FONT&gt;
2021 = 'lighttan'
2022  = 'lightpink'
2023  = 'lightblue'
;
run;

proc tabulate data=&amp;amp;Pathogen.;
  Class year state Quarter/ missing;
  classlev year /style=[backgroundcolor=&lt;FONT size="5" color="#FF0000"&gt;&lt;STRONG&gt;yearcolor.&lt;/STRONG&gt;&lt;/FONT&gt;];
  var Positive Test ;
  table State*(positive*f=10.0*[style=olive] test*f=10.0),year*[style=[background=yearcolor.]]*(quarter all);
  Label State="State" Positive="Total Positive counts" Test="Total Test counts";
  Title '&amp;amp;Pathogen._test#_sum';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Please let me know where I should modify my code.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;FWIW, I find that the basic pink is awful light and generally use lightred or verylightred instead when I want a pinkish shade.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Dec 2023 17:51:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Table-output-in-Color/m-p/906766#M358035</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-12-07T17:51:02Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate Table output in Color?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Table-output-in-Color/m-p/906771#M358036</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sample.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/90951i56F656625E04D861/image-size/large?v=v2&amp;amp;px=999" role="button" title="Sample.png" alt="Sample.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Dec 2023 18:00:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Table-output-in-Color/m-p/906771#M358036</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2023-12-07T18:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate Table output in Color?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Table-output-in-Color/m-p/906772#M358037</link>
      <description>The picture shows the result, light color is fine.  But all the background results in three years were no difference, neither with Total Positive counts font color.</description>
      <pubDate>Thu, 07 Dec 2023 18:03:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Table-output-in-Color/m-p/906772#M358037</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2023-12-07T18:03:20Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate Table output in Color?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Table-output-in-Color/m-p/906805#M358060</link>
      <description>Note that you specify a colour but not where it applies, font, backgroundcolour, line colour....you're on the right track. Keep playing around.</description>
      <pubDate>Thu, 07 Dec 2023 18:52:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Table-output-in-Color/m-p/906805#M358060</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-12-07T18:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate Table output in Color?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Table-output-in-Color/m-p/906813#M358063</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; You might also want to search in the documentation and on the support web site. For example, in this example&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_0-1701976073791.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/90956i0AE3AAECD56269DA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_0-1701976073791.png" alt="Cynthia_sas_0-1701976073791.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;contained in this Tech Support note: &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;&amp;nbsp; You can see that the color for each column inherits the color of the header under which the column is nested. This is known as using style=&amp;lt;parent&amp;gt; which is a style override feature of PROC TABULATE. This feature allows you to do either horizontal or vertical "banding" based on the style characteristics that you associate usually with a CLASSLEV header variable.&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Dec 2023 19:10:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Table-output-in-Color/m-p/906813#M358063</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2023-12-07T19:10:18Z</dc:date>
    </item>
  </channel>
</rss>

