Program
options nodate pageno=1;
ods html body='external-HTML-file';
ods pdf file='external-PDF-file';
ods rtf file='external-RTF-file';
proc tabulate data=energy style=[fontweight=bold];
class region division type / style=[textalign=center];
classlev region division type / style=[textalign=left];
var expenditures / style=[fontsize=3];
keyword all sum / style=[fontwidth=wide];
keylabel all="Total";
table (region all)*(division all*[style=[backgroundcolor=yellow]]),
(type all)*(expenditures*f=dollar10.) /
style=[bordercolor=blue]
misstext=[label="Missing" style=[fontweight=light]]
box=[label="Region by Division by Type"
style=[fontstyle=italic]];
format region regfmt. division divfmt. type usetype.;
title 'Energy Expenditures';
title2 '(millions of dollars)';
run;
ods html close;
ods pdf close;
ods rtf close;
Program Description
Set the SAS system options.The
NODATE option suppresses the display of the date and time in the output.
PAGENO= specifies the starting page number. LINESIZE= and PAGESIZE=
are not set for this example because they have no effect on HTML,
RTF, and Printer output.
Specify the ODS output filenames.By opening multiple ODS destinations, you can produce
multiple output files in a single execution. The ODS HTML statement
produces output that is written in HTML. The ODS PDF statement produces
output in Portable Document Format (PDF). The ODS RTF statement produces
output in Rich Text Format (RTF). The output from PROC TABULATE goes
to each of these files.
ods html body='external-HTML-file';
ods pdf file='external-PDF-file';
ods rtf file='external-RTF-file';
Specify the table options.The
STYLE= option in the PROC TABULATE statement specifies the style element
for the data cells of the table.
proc tabulate data=energy style=[fontweight=bold];
Specify subgroups for the analysis.The STYLE= option in the CLASS statement specifies
the style element for the class variable name headings.
class region division type / style=[textalign=center];
Specify the style attributes for the class variable value
headings.The STYLE= option in the CLASSLEV
statement specifies the style element for the class variable level
value headings.
classlev region division type / style=[textalign=left];
Specify the analysis variable and its style attributes.The STYLE= option in the VAR statement specifies
a style element for the variable name headings.
var expenditures / style=[fontsize=3];
Specify the style attributes for keywords, and label the
“all” keyword. The STYLE=
option in the KEYWORD statement specifies a style element for keywords.
The KEYLABEL statement assigns a label to the keyword.
keyword all sum / style=[fontwidth=wide];
keylabel all="Total";
Define the table rows and columns and their style attributes.The STYLE= option in the dimension expression overrides
any other STYLE= specifications in PROC TABULATE that specify attributes
for table cells. The STYLE= option after the slash (/) specifies attributes
for parts of the table other than table cells.
table (region all)*(division all*[style=[backgroundcolor=yellow]]),
(type all)*(expenditures*f=dollar10.) /
style=[bordercolor=blue]
Specify the style attributes for cells with missing values.The STYLE= option in the MISSTEXT option of the TABLE
statement specifies a style element to use for the text in table cells
that contain missing values.
misstext=[label="Missing" style=[fontweight=light]]
Specify the style attributes for the box above the row
titles.The STYLE= option in the BOX
option of the TABLE statement specifies a style element to use for
text in the box above the row titles.
box=[label="Region by Division by Type"
style=[fontstyle=italic]];
Format the class variable values.The FORMAT statement assigns formats to Region, Division,
and Type.
format region regfmt. division divfmt. type usetype.;
title 'Energy Expenditures';
title2 '(millions of dollars)';
run;
Close the ODS destinations.
ods html close;
ods pdf close;
ods rtf close;