| Enhancing HTML Tabular Reports |
| Altering the Appearance of
Text |
| Now that all the Laguardia cell backgrounds are colored, let's turn our attention to the text in those cells. You set cell color with the background attribute of the STYLE= option; six other attributes let you alter the color, size, and style of table text. |
| Attribute | Sample Values |
|---|---|
| foreground | white, cx336699 |
| font_face | times, helv, courier, serif |
| font_size | 1-7, 10pt, 0.2in |
| font_style | roman, italic, slant |
| font_weight | light, medium, bold, black |
| font_width | compressed, narrow, normal, wide |
| Examples
To display your table's keyword headings in italics, add a font_style attribute and value to the STYLE= option of the KEYWORD statement. |
keyword min max mean sum /
style={background=cxCCEEDD font_style=italic};
|
Do the same to the Dest heading by editing the CLASS statement. |
class dest / style={background=cxCCEEDD font_style=italic};
|
Revenue values are especially important in this table, so highlight the
Revenue headings. You want to set the foreground attribute to
black in the VAR statement's STYLE= option. However, the current argument
of this STYLE= option is <parent>. Where do you put the extra
attribute and value? |
var revenue / style=<parent>; |
| To supplement inherited attributes, add braces |
var revenue / style=<parent>{foreground=black};
|
Your program and its output look as follows. Notice that the
Revenue data cells have inherited the color assigned to
Revenue heading text. Remember, all style
attributes are inherited when <parent> is used as the argument of the
STYLE= option. |
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';
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 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 | |
![]() ![]() |
|
Copyright © 2002 SAS Institute Inc.,
Cary, NC, USA. All rights reserved.