Mexico M 432000 A300 R 785 19625.00
Canada L 837000 A300 R 806 20150.00
France L 748000 A300 R 768 19200.00
Mexico L 932000 A300 R 880 22000.00
Brazil S 25000 A300 W 157 3140.00
Canada S 37000 A300 W 208 4160.00
Mexico S 32000 A300 W 186 3720.00
Brazil M 125000 A300 W 351 7020.00
Canada M 237000 A300 W 610 12200.00
France M 348000 A300 W 714 14280.00
Mexico M 432000 A300 W 785 15700.00
Brazil L 625000 A300 W 757 15140.00
Canada L 837000 A300 W 806 16120.00
France L 748000 A300 W 768 15360.00
Mexico L 932000 A300 W 880 17600.00
;
proc format;
value $salefmt 'R'='Retail'
'W'='Wholesale';
proc tabulate style={foreground=green background=white};
class region citysize saletype / style={foreground=black};
classlev region citysize saletype / style={foreground=red};
var quantity amount / style={foreground=black};
keyword all sum / style={foreground=purple };
format saletype $salefmt.;
label region="Region" citysize="Citysize" saletype="Saletype";
label quantity="Quantity" amount="Amount";
keylabel all="Total";
table all={label = "All Products" style={foreground=orange font_weight=bold}},
(region all )*(citysize all*{style={foreground=CX002288 font_weight=bold}}),
(saletype all)*(quantity*f=COMMA6. amount*f=dollar10.) /
style={background=red} misstext={label="Missing"
style={foreground=brown font_weight=bold }}
box={label="Region by Citysize by Saletype"
style={foreground=brown background=cxebdded}};
run;
ods html close;
PDF Output
options center nodate;
ods pdf body="b.pdf" style=barrettsblue;
title1 'TABULATE With Custom ODS Styles';
data tabulate;
input dept acct qtr mon expense @@;
datalines;
1 1345 1 1 12980 1 1674 1 3 13135 3 4138 1 1 29930
1 1345 1 1 9475 1 1674 1 3 21672 3 4138 1 2 22530
1 1345 1 1 15633 1 1674 1 3 3847 3 4138 1 2 16446
1 1345 1 2 14009 1 1674 1 3 2808 3 4138 1 2 27135
1 1345 1 2 10226 1 1674 1 3 4633 3 4138 1 3 24399
1 1345 1 2 16872 2 2134 1 1 34520 3 4138 1 3 17811
1 1345 1 2 17800 2 2134 1 1 25199 3 4138 1 3 29388
1058 Appendix 2 Example Programs

Get SAS 9.4 Output Delivery System, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.