Attribute
PROC
REPORT
STATEMENT
REPORT
Area
PROC
REPORT
Areas:
CALLDEF,
COLUMN,
HEADER,
LINES,
SUMMARY
PROC
TABULATE
STATEMENT
TABLE
PROC
TABULATE
STATEMENTS
VAR, CLASS,
BOX,
CLASSLEV,
KEYWORD
PROC
PRINT
TABLE
location
PROC
PRINT:
all
locations
other
than
TABLE
RULES= X X X
TAGATTR= X X X X X X
TEXTALIGN= X X X X X X
URL= X X X
VERTICALALIGN= X X X
WIDTH= X X X X X
*
When you use these attributes in this location, they affect only the text that is specified with the PRETEXT=, POSTTEXT=,
PREHTML=, and POSTHTML= attributes. To alter the foreground color or the font for the text that appears in the table, you must set
the corresponding attribute in a location that affects the cells rather than the table. For complete documentation about style attributes
and their values, see “Style Attributes” on page 833.
Using Styles with Base SAS Procedures
Most Base SAS procedures that support ODS use one or more table templates to produce
output objects. These table templates include templates for table elements: columns,
headers, and footers. Each table element can specify the use of one or more style
elements for various parts of the output. These style elements cannot be specified within
the syntax of the procedure, but you can use customized styles for the ODS destinations
that you use. For more information about customizing tables and styles, see Chapter 14,
“TEMPLATE Procedure: Creating a Style Template Procedure” in SAS 9.4 Output
Delivery System: Procedures Guide.
The Base SAS reporting procedures, PROC PRINT, PROC REPORT, and PROC
TABULATE, enable you to quickly analyze your data and organize it into easy-to-read
tables. You can use the STYLE= option with these procedure statements to modify the
appearance of your report. The STYLE= option enables you to make changes in sections
of output without changing the default style for all of the output. You can customize
specific sections of procedure output by specifying the STYLE= option in specific
statements within the procedure.
The following program uses the STYLE= option to create the background colors in the
PROC REPORT output below:
title "Height and Weight by Gender and Age";
proc report nowd data=sashelp.class
style(header)=[background=white];
col age (('Gender' sex),(weight height));
define age / style(header)=[background=lightgreen];
define sex / across style(header)=[background=yellow] ' ';
define weight / style(header)=[background=orange];
define height / style(header)=[background=tan];
Using Styles with Base SAS Procedures 777
run;
Display 8.1 Enhanced PROC REPORT Output
The following program uses the STYLE= option to create the colors in the PROC
TABULATE output below:
proc sort data=sashelp.prdsale out=prdsale;
by Country;
run;
proc tabulate data=prdsale;
class region division prodtype / style=[background=lightgreen];
classlev region division prodtype / style=[background=yellow];
var actual / style=[background=tan];
keyword all sum / style=[background=linen color=blue];
keylabel all='Total';
table (region all)*(division all),
(prodtype all)*(actual*f=dollar10.) /
box=[label='Region by Division and Type' style=[backgroundcolor=orange]];
title 'Actual Product Sales';
title2 '(millions of dollars)';
run;
778 Chapter 8 Overview
Display 8.2 Enhanced PROC TABULATE Output
The following program uses the STYLE= option to create the colors in the PROC
PRINT output below:
proc print data=exprev noobs sumlabel='Total' GRANDTOTAL_LABEL="Grand Total"
style(table)=[frame=box rules=groups]
style(bysumline)=[background=red foreground=linen]
style(grandtotal)=[foreground=green]
style(header)=[font_style=italic background=orange];
by sale_type order_date;
sum price quantity;
sumby sale_type;
label sale_type='Sale Type' order_date='Sale Date';
format price dollar10.2 cost dollar10.2;
var Country / style(data)=[font_face=arial font_weight=bold background=linen];
var Price / style(data)=[font_style=italic background=yellow];
var Cost / style(data)=[foreground=hgt. background=lightgreen];
title 'Retail and Quantity Totals for Each Sale Type';
run;
For the complete input data set, see Appendix 3, “EXPREV,” in Base SAS Procedures
Guide.
Using Styles with Base SAS Procedures 779
Display 8.3 Enhanced PROC PRINT Output
780 Chapter 8 Overview

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.