SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Enhancing HTML Tabular Reports
Adding Cell Traffic-Lighting


Aside from improving your table's appearance, the STYLE= option can draw attention to specific cell values. For example, the Laguardia table shows passenger traffic, but a user has to study the Deplaned values to locate the least and most popular routes.

You can point to this data by coloring Deplaned cells according to the values within them. Whenever values fall outside a specific range, PROC TABULATE creates a visual alert, known as traffic-lighting.


Low Value Alert
Boarded 81 
Transferred
Deplaned   103 
  
No Alert
Boarded   170 
Transferred 13 
Deplaned   188 
  
High Value Alert
Boarded   241 
Transferred 18 
Deplaned   250 


You add this cell traffic-lighting by applying a user-defined format to Deplaned through the STYLE= option. It's the same technique you used to set the colors of the Dest class level headings:
  1. Create a format called DEPLBACK to associate with the values of Deplaned.

    • For values of low-105, use SAS/GRAPH color name LIPK (light pink).

    • For values of 245-250, use SAS/GRAPH color name VPAPB (very pale purplish blue).

    • For other values, use SAS/GRAPH color name YWH (yellowish white, to match the rest of the data cells).

          value deplback low-105='lipk'
                         245-250='vpapb'
                         other='ywh';
  1. Associate this format with Deplaned in the TABLE statement. Enclose the entire STYLE= option in braces { } and attach it to Deplaned with an asterisk (*).

        table dest*(boarded transferred
              deplaned*{style={background=deplback.}}
              revenue*{style=<parent>}),min max mean sum /
              box={style={background=cxCCEEDD}};

Your program and its output look as follows.

     ods listing close;
     ods html path='c:\data' body='laguard.html';
     title1 'Laguardia Flights by Destination';
     title2 'and Revenue, March 4-10';
     proc format;
        value $desname 'CPH'='Copenhagen'
                       'FRA'='Frankfurt'
                       'LON'='London'
                       'PAR'='Paris';
        value $desback 'CPH'='cxBBDDCC'
                       'FRA'='cxAACCBB'
                       'LON'='cx99BBAA'
                       'PAR'='cx88AA99';
        value deplback low-105='lipk'
                       245-250='vpapb'
                       other='ywh';
     run;
     proc tabulate data=flights.laguardia format=comma9.
          style={background=ywh};
        class dest / style={background=cxCCEEDD font_style=italic};
        classlev dest / style={background=$desback.};
        var boarded transferred deplaned / style={background=cxCCEEDD};
        var revenue / style=<parent>{foreground=black};
        table dest*(boarded transferred
              deplaned*{style={background=deplback.}}
              revenue*{style=<parent>}),min max mean sum /
              box={style={background=cxCCEEDD}};
        keyword min max mean sum /
                style={background=cxCCEEDD font_style=italic};
        label dest='Destination';
        format dest $desname.;
     run;
     ods html close;
     ods listing;

Laguardia Flights by Destination
and Revenue, March 4-10

  Min Max Mean Sum
Destination   81 154 131 786
Copenhagen Boarded
Transferred 5 21 13 75
Deplaned 103 177 147 881
Revenue 109,885 196,540 139,951 839,705
Frankfurt Boarded 129 210 170 1,190
Transferred 5 22 13 91
Deplaned 147 237 188 1,314
Revenue 100,987 187,636 142,912 1,000,382
London Boarded 151 241 188 3,760
Transferred 4 18 11 227
Deplaned 114 250 199 3,987
Revenue 106,753 198,744 159,478 3,189,554
Paris Boarded 146 182 161 2,089
Transferred 7 29 16 204
Deplaned 153 227 183 2,378
Revenue 123,456 195,468 151,477 1,969,201



  back||next


Copyright © 2002 SAS Institute Inc., Cary, NC, USA. All rights reserved.

Terms of Use & Legal Information | Privacy Statement