<?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: Need Final Steps for PROC TABULATE Traffic Lighting with PROC FORMAT in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Need-Final-Steps-for-PROC-TABULATE-Traffic-Lighting-with-PROC/m-p/798918#M81631</link>
    <description>&lt;P&gt;I managed to do something like that with Proc Tabulate one time but the amount of custom coding, pre-summarizing data, writing custom formats for not-actually-values displayed was such that it would be faster to manually set colors. That approach involved creating unique values for the cells that display, by that I mean to display a blue 2 the value was actually like 2.1 and for a yellow 2 it was 2.2 so that a single format could be assigned. Not interested in going there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also see some serious complications with Proc Report because of the multiple nestings in both row and column and how to address the column values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I were to attempt such a thing again I would 1) summarize the data first (possibly with Proc Tabulate creating an output data set) and then 2) look at the data step Report Writing Interface which is going to let you examine multiple variables to set properties for cells.&lt;/P&gt;</description>
    <pubDate>Sun, 27 Feb 2022 02:53:15 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2022-02-27T02:53:15Z</dc:date>
    <item>
      <title>Need Final Steps for PROC TABULATE Traffic Lighting with PROC FORMAT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-Final-Steps-for-PROC-TABULATE-Traffic-Lighting-with-PROC/m-p/798835#M81627</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2022-02-26 073255.jpg" style="width: 587px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/68963i5D582290DD49CF1B/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2022-02-26 073255.jpg" alt="Screenshot 2022-02-26 073255.jpg" /&gt;&lt;/span&gt;Hello SAS Community!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Objective &lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Create a table which highlights the cells using the following rules:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4cyl cars which begin with "A": color the cells blue&lt;/P&gt;
&lt;P&gt;NOT 4cyl cars that do NOT begin with "A": color the cells yellow.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I’d also like the total (105 for this subset) to show up, if possible.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My SAS attempt is below (doesn't work).&lt;/P&gt;
&lt;P&gt;My Excel desired output is also displayed.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data cars;
	set sashelp.cars;

if substr(make, 1, 1) in ("A" "B" "C");

if (cylinders = 4) and (substr(make,1,1) = "A") THEN BG1F=0;else
IF (clyinders NE 4) and (substr(make,1,1) ne "A") then BG1F=1;


keep make type origin cylinders;

run;

proc format;
	value 	bg1f	0=blue 1=yellow;
 
run;

proc tabulate data=cars style={  background=bg1f.};
	class make type origin cylinders;
	classlev make;
	tables (all='')*(make)*(type),(origin)*(cylinders)*all/nocellmerge;
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Feb 2022 13:50:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-Final-Steps-for-PROC-TABULATE-Traffic-Lighting-with-PROC/m-p/798835#M81627</guid>
      <dc:creator>MelissaM</dc:creator>
      <dc:date>2022-02-26T13:50:45Z</dc:date>
    </item>
    <item>
      <title>Re: Need Final Steps for PROC TABULATE Traffic Lighting with PROC FORMAT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-Final-Steps-for-PROC-TABULATE-Traffic-Lighting-with-PROC/m-p/798840#M81628</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You want an example on color formats?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc format;
value $sexfmt
'M'='light blue'
'F'='pink';
run;

ods html path='C:\WorkShop\' body='printout.html';
proc print data=sashelp.class noobs;
where Age = 15;
var Name Height;
var Sex / style=[background=$sexfmt. font_weight=bold];
run;
ods html close;
/* end of program */&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Sat, 26 Feb 2022 13:29:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-Final-Steps-for-PROC-TABULATE-Traffic-Lighting-with-PROC/m-p/798840#M81628</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2022-02-26T13:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: Need Final Steps for PROC TABULATE Traffic Lighting with PROC FORMAT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-Final-Steps-for-PROC-TABULATE-Traffic-Lighting-with-PROC/m-p/798844#M81629</link>
      <description>It didn't work for me, unfortunately. &lt;BR /&gt;I updated my post to show the desired output (in MS Excel),  which shows blue &amp;amp; yellow cells.&lt;BR /&gt;</description>
      <pubDate>Sat, 26 Feb 2022 13:45:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-Final-Steps-for-PROC-TABULATE-Traffic-Lighting-with-PROC/m-p/798844#M81629</guid>
      <dc:creator>MelissaM</dc:creator>
      <dc:date>2022-02-26T13:45:40Z</dc:date>
    </item>
    <item>
      <title>Re: Need Final Steps for PROC TABULATE Traffic Lighting with PROC FORMAT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-Final-Steps-for-PROC-TABULATE-Traffic-Lighting-with-PROC/m-p/798864#M81630</link>
      <description>&lt;P&gt;The OP's traffic lighting needs for highlighting selective cells are not dependent on the values in the cells. Instead, they are dependent on row and column values, so&amp;nbsp;I do not see how a format utilized in a PROC TABULATE can do the job.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I wonder if some of the PROC REPORT experts on this forum could produce the desired results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Feb 2022 16:42:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-Final-Steps-for-PROC-TABULATE-Traffic-Lighting-with-PROC/m-p/798864#M81630</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2022-02-26T16:42:53Z</dc:date>
    </item>
    <item>
      <title>Re: Need Final Steps for PROC TABULATE Traffic Lighting with PROC FORMAT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-Final-Steps-for-PROC-TABULATE-Traffic-Lighting-with-PROC/m-p/798918#M81631</link>
      <description>&lt;P&gt;I managed to do something like that with Proc Tabulate one time but the amount of custom coding, pre-summarizing data, writing custom formats for not-actually-values displayed was such that it would be faster to manually set colors. That approach involved creating unique values for the cells that display, by that I mean to display a blue 2 the value was actually like 2.1 and for a yellow 2 it was 2.2 so that a single format could be assigned. Not interested in going there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also see some serious complications with Proc Report because of the multiple nestings in both row and column and how to address the column values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I were to attempt such a thing again I would 1) summarize the data first (possibly with Proc Tabulate creating an output data set) and then 2) look at the data step Report Writing Interface which is going to let you examine multiple variables to set properties for cells.&lt;/P&gt;</description>
      <pubDate>Sun, 27 Feb 2022 02:53:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-Final-Steps-for-PROC-TABULATE-Traffic-Lighting-with-PROC/m-p/798918#M81631</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-02-27T02:53:15Z</dc:date>
    </item>
    <item>
      <title>Re: Need Final Steps for PROC TABULATE Traffic Lighting with PROC FORMAT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-Final-Steps-for-PROC-TABULATE-Traffic-Lighting-with-PROC/m-p/800077#M81650</link>
      <description>&lt;P&gt;You are both correct.&lt;BR /&gt;I was able to use formatting to assign values within the cells, but that didn't work for my actual data because:&lt;BR /&gt;1. I want the program to be dynamic so the highlighting updates when the data is updated, and&lt;BR /&gt;2. For example, this data had multiple cells with 1's. I only wanted to highlight a single cell with a 1.&lt;BR /&gt;Here's a link with much more information on the topic:&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Colouring-proc-tabulate-columns-by-column-classification-value/td-p/457986" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Programming/Colouring-proc-tabulate-columns-by-column-classification-value/td-p/457986&lt;/A&gt; &lt;/P&gt;</description>
      <pubDate>Fri, 04 Mar 2022 07:02:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-Final-Steps-for-PROC-TABULATE-Traffic-Lighting-with-PROC/m-p/800077#M81650</guid>
      <dc:creator>MelissaM</dc:creator>
      <dc:date>2022-03-04T07:02:26Z</dc:date>
    </item>
  </channel>
</rss>

