Sample 25406: Demonstrates ODS Styles with PROC TABULATE
This logic is also applicable in the ODS PRINTER (PCL/PDF/PS), and RTF destinations.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
This sample is from the SAS Sample Library. For additional information refer to "SAS Output Delivery System: User's Guide".
/****************************************************************/
/* S A S S A M P L E L I B R A R Y */
/* */
/* NAME: ODSTAB5 */
/* TITLE: Demonstrates ODS Styles with PROC TABULATE */
/* PRODUCT: BASE */
/* SYSTEM: ALL */
/* KEYS: ODS HTML BODY= */
/* PROCS: TABULATE */
/* DATA: */
/* SUPPORT: UPDATE: */
/* REF: */
/* MISC: */
/* */
/****************************************************************/
/* Point ODS in the right direction. */
ods html body="odstab5.htm";
ods listing close;
title1 'TABLE REGIONS AFFECTED BY STYLES';
title2 'Blue: Class variable headings';
title3 'Yellow: Class level headings';
title4 'Black: Analysis variable headings';
title5 'White: Keyword headings';
title6 'Purple: Box text - Green: Data cells';
title7 'Brown: Data cells with missing values';
title8 'Dark Blue: Crossing data cells';
title9 'Red: Table - Orange: Caption';
data;
input region $ citysize $ pop product $ saletype $
quantity amount;
cards;
NC S 25000 A100 R 150 3750.00
NE S 37000 A100 R 200 5000.00
SO S 48000 A100 R 410 10250.00
WE S 32000 A100 R 180 4500.00
NC M 125000 A100 R 350 8750.00
NE M 237000 A100 R 600 15000.00
SO M 348000 A100 R 710 17750.00
WE M 432000 A100 R 780 19500.00
NE L 837000 A100 R 800 20000.00
SO L 748000 A100 R 760 19000.00
WE L 932000 A100 R 880 22000.00
NC S 25000 A100 W 150 3000.00
NE S 37000 A100 W 200 4000.00
WE S 32000 A100 W 180 3600.00
NC M 125000 A100 W 350 7000.00
NE M 237000 A100 W 600 12000.00
SO M 348000 A100 W 710 14200.00
WE M 432000 A100 W 780 15600.00
NC L 625000 A100 W 750 15000.00
NE L 837000 A100 W 800 16000.00
SO L 748000 A100 W 760 15200.00
WE L 932000 A100 W 880 17600.00
NC S 25000 A200 R 165 4125.00
NE S 37000 A200 R 215 5375.00
SO S 48000 A200 R 425 10425.00
WE S 32000 A200 R 195 4875.00
NC M 125000 A200 R 365 9125.00
NE M 237000 A200 R 615 15375.00
SO M 348000 A200 R 725 19125.00
WE M 432000 A200 R 795 19875.00
NE L 837000 A200 R 815 20375.00
SO L 748000 A200 R 775 19375.00
WE L 932000 A200 R 895 22375.00
NC S 25000 A200 W 165 3300.00
NE S 37000 A200 W 215 4300.00
WE S 32000 A200 W 195 3900.00
NC M 125000 A200 W 365 7300.00
NE M 237000 A200 W 615 12300.00
SO M 348000 A200 W 725 14500.00
WE M 432000 A200 W 795 15900.00
NC L 625000 A200 W 765 15300.00
NE L 837000 A200 W 815 16300.00
SO L 748000 A200 W 775 15500.00
WE L 932000 A200 W 895 17900.00
NC S 25000 A300 R 157 3925.00
NE S 37000 A300 R 208 5200.00
SO S 48000 A300 R 419 10475.00
WE S 32000 A300 R 186 4650.00
NC M 125000 A300 R 351 8725.00
NE M 237000 A300 R 610 15250.00
SO M 348000 A300 R 714 17850.00
WE M 432000 A300 R 785 19625.00
NE L 837000 A300 R 806 20150.00
SO L 748000 A300 R 768 19200.00
WE L 932000 A300 R 880 22000.00
NC S 25000 A300 W 157 3140.00
NE S 37000 A300 W 208 4160.00
WE S 32000 A300 W 186 3720.00
NC M 125000 A300 W 351 7020.00
NE M 237000 A300 W 610 12200.00
SO M 348000 A300 W 714 14280.00
WE M 432000 A300 W 785 15700.00
NC L 625000 A300 W 757 15140.00
NE L 837000 A300 W 806 16120.00
SO L 748000 A300 W 768 15360.00
WE L 932000 A300 W 880 17600.00
proc format;
value $salefmt 'R'='Retail'
'W'='Wholesale';
/* Tabulate Style References override any Style previously */
/* set by HTML (default or otherwise). */
proc tabulate s={foreground=green};
class region citysize saletype / s={foreground=blue};
classlev region citysize saletype / s={foreground=yellow};
var quantity amount / s={foreground=black};
keyword all sum / s={foreground=white};
format saletype $salefmt.;
label region="Region" citysize="Citysize" saletype="Saletype";
label quantity="Quantity" amount="Amount";
keylabel all="Total";
table all={label = "All Products" s={foreground=orange}},
(region all)*(citysize all*{s={foreground=#002288}}),
(saletype all)*(quantity*f=COMMA6. amount*f=dollar10.) /
s={background=red}
misstext={label="Missing" s={foreground=brown}}
box={label="Region by Citysize by Saletype"
s={foreground=purple}};
run;
/* All done, let us take a look. */
ods html close;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
Make style changes with TABULATE instead of PROC TEMPLATE.
| Type: | Sample |
| Topic: | Third Party ==> Output ==> HTML SAS Reference ==> Procedures ==> TABULATE SAS Reference ==> ODS (Output Delivery System)
|
| Date Modified: | 2005-08-12 03:02:29 |
| Date Created: | 2005-05-23 13:51:40 |
Operating System and Release Information
| SAS System | Base SAS | All | 9.1 TS1M3 | n/a |