PRINT Procedure

Use ODS Styles with PROC PRINT

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 TEMPLATE Procedure: Creating a Style Template in SAS 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 colors in the PROC PRINT output below. For the complete input data set, see EXPREV.

ods _all_ close;
ods html5 file="file-path/customStyle.html";
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;
ods _all_ close;

Enhanced PROC PRINT Output

Enhanced PROC PRINT Output

Styles, Style Elements, and Style Attributes

Understanding Styles, Style Elements, and Style Attributes

The appearance of SAS output is controlled by ODS style templates (ODS styles). ODS styles are produced from compiled STYLE templates written in PROC TEMPLATE style syntax. An ODS style template is a collection of style elements that provides specific visual attributes for your SAS output.

  • A style element is a named collection of style attributes that apply to a particular part of the output. Each area of ODS output has a style element name that is associated with it. The style element name specifies where the style attributes are applied. For example, a style element might contain instructions for the presentation of column headings or for the presentation of the data inside the cells. Style elements might also specify default colors and fonts for output that uses the style.
  • A style attribute is a visual property, such as color, font properties, and line characteristics, that is defined in ODS with a reserved name and value. Style attributes are collectively referenced by a style element within a style template. Each style attribute specifies a value for one aspect of the presentation. For example, the BACKGROUNDCOLOR= attribute specifies the color for the background of an HTML table or for a colored table in printed output. The FONTSTYLE= attribute specifies whether to use a Roman font or an italic font.
Note: Because styles control the presentation of the data, they have no effect on output objects that go to the DOCUMENT or OUTPUT destination.

Available styles are in the SASHELP.TMPLMST item store.You can display the list of available style templates by using the LIST statement in PROC TEMPLATE:

proc template;
   list styles / store=sashelp.tmplmst;
run;

For complete information about viewing ODS styles, see Viewing ODS Styles Supplied by SAS in SAS Output Delivery System: Procedures Guide.

HTML5 output uses the HTMLEncore style template. To help you become familiar with styles, style elements, and style attributes, look at the relationship between them.

You can use the SOURCE statement in PROC TEMPLATE to display the structure of a style template. The following code prints the structure of the HTMLBlue style template to the SAS log:

proc template;
   source styles.HTMLBlue; 
run;

The following figure illustrates the structure of a style. The figure shows the relationship between the style, the style elements, and the style attributes.

Diagram of the HtmlBlue Style
Diagram of the HtmlBlue Style

The following list corresponds to the numbered items in the preceding figure:

  1. Styles.HtmlBlue is the style. Styles describe how to display presentation aspects (color, font, font size, and so on) of the SAS output. A style determines the overall appearance of the ODS documents that use it. The default style for HTML output is HtmlBlue. Each style consists of style elements.

    You can create new styles with the DEFINE STYLE Statement in SAS Output Delivery System: Procedures Guide. New styles can be created independently or from an existing style. You can use PARENT= Statement in SAS Output Delivery System: Procedures Guide to create a new style from an existing style. For complete documentation about ODS styles, see Style Templates in SAS Output Delivery System: Procedures Guide.

  2. Header and Footer are examples of style elements. A style element is a collection of style attributes that apply to a particular part of the output for a SAS program. For example, a style element might contain instructions for the presentation of column headings or for the presentation of the data inside table cells. Style elements might also specify default colors and fonts for output that uses the style. Style elements exist inside styles and consist of one or more style attributes. Style elements can be user-defined or supplied by SAS. User-defined style elements can be created by the STYLE Statement in SAS Output Delivery System: Procedures Guide.

    Note: For a list of the default style elements used for HTML and markup languages and their inheritance, see Style Elements in SAS Output Delivery System: Procedures Guide.
  3. BORDERCOLOR=, BACKGROUNDCOLOR=, and COLOR= are examples of style attributes. Style attributes specify a value for one aspect of the area of the output that its style element applies to. For example, the COLOR= attribute specifies the value cx112277 for the font color. For a list of style attributes supplied by SAS, see Style Attributes in SAS Output Delivery System: Procedures Guide.

    Style attributes can be referenced with style references. See style-reference in SAS Output Delivery System: Procedures Guide for more information about style references.

The following table shows commonly used style attributes that you can set with the STYLE= option in PROC PRINT, PROC TABULATE, and PROC REPORT. Most of these attributes apply to parts of the table other than cells (for example, table borders and the lines between columns and rows). Note that not all attributes are valid in all destinations. For more information about these style attributes, their valid values, and their applicable destinations, see Style Attributes Tables in SAS Output Delivery System: Procedures Guide.

Style Attributes for PROC REPORT, PROC TABULATE, and PROC PRINT

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

ASIS=

X

X

X

X

BACKGROUNDCOLOR=

X

X

X

X

X

X

BACKGROUNDIMAGE=

X

X

X

X

X

X

BORDERBOTTOMCOLOR=

X

X

X

BORDERBOTTOMSTYLE=

X

X

X

X

BORDERBOTTOMWIDTH=

X

X

X

X

BORDERLEFTCOLOR=

X

X

X

BORDERLEFTSTYLE=

X

X

X

X

BORDERLEFTWIDTH=

X

X

X

X

BORDERCOLOR=

X

X

X

X

X

BORDERCOLORDARK=

X

X

X

X

X

X

BORDERCOLORLIGHT=

X

X

X

X

X

X

BORDERRIGHTCOLOR=

X

X

X

BORDERRIGHTSTYLE=

X

X

X

X

BORDERRIGHTWIDTH=

X

X

X

X

BORDERTOPCOLOR=

X

X

X

BORDERTOPSTYLE=

X

X

X

X

BORDERTOPWIDTH=

X

X

X

X

BORDERWIDTH=

X

X

X

X

X

X

CELLPADDING=

X

X

X

CELLSPACING=

X

X

X

CELLWIDTH=

X

X

X

X

X

CLASS=

X

X

X

X

X

X

COLOR=

X

X

X

FLYOVER=

X

X

X

X

FONT=

X

X

X

X

X

X

FONTFAMILY=

X

X

X

X

X

X

FONTSIZE=

X

X

X

X

X

X

FONTSTYLE=

X

X

X

X

X

X

FONTWEIGHT=

X

X

X

X

X

X

FONTWIDTH=

X

X

X

X

X

FRAME=

X

X

X

HEIGHT=

X

X

X

X

X

HREFTARGET=

X

X

X

HTMLSTYLE=

X

X

X

X

X

NOBREAKSPACE=2

X

X

X

X

OUTPUTWIDTH=

X

X

X

X

X

POSTHTML=1

X

X

X

X

X

X

POSTIMAGE=

X

X

X

X

X

X

POSTTEXT=1

X

X

X

X

X

X

PREHTML=1

X

X

X

X

X

X

PREIMAGE=

X

X

X

X

X

X

PRETEXT=1

X

X

X

X

X

X

PROTECTSPECIALCHARS=

X

X

X

X

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

1 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 in SAS Output Delivery System: Procedures Guide.
2 To help prevent unexpected wrapping of long text strings when using PROC REPORT with the ODS RTF destination, set NOBREAKSPACE=OFF in a location that affects the LINE statement. The NOBREAKSPACE=OFF attribute must be set in the PROC REPORT code either on the LINE statement or on the PROC REPORT statement where style(lines) is specified.

Default Style Elements and Style Attributes for Table Regions

The following table lists the default style elements and style attributes for various locations of PROC PRINT output. The locations in this table correspond to the locations in Specifying Locations in the STYLE Option.

The table lists defaults for the most commonly used ODS destinations: HTML5, PDF, and RTF. Each destination has a default style template that is applied to all output that is written to the destination. For complete documentation about the ODS destinations and their default styles, see Style Templates in SAS Output Delivery System: Procedures Guide.

Note: The default style for ODS output in SAS Data and AI Studio is set by the theme that the session is actively using. Depending on the theme, the default is either Illuminate, Ignite, or HighContrast. For more information, see Customizing SAS Data and AI Studio in SAS Data and AI Studio: User’s Guide.
  • The default style for HTML5 output is HTMLEncore.
  • The default style for PDF output is Pearl.
  • The default style for RTF output is RTF.
Default Style Elements and Style Attributes for Report Regions

Location

Style Element

HTML5 Style Attributes

PDF Style Attributes

RTF Style Attributes

BYLABEL

Byline

FONTFAMILY = "'Avenir Next for SAS', Arial, 'Albany AMT', Helvetica, Helv"

FONTSIZE = 2

FONTWEIGHT = bold

FONTSTYLE = roman

COLOR = cx112277

BACKGROUNDCOLOR = cxedf2f9

FONTFAMILY = "Arial, 'Albany AMT’"

FONTSIZE = 8pt

FONTWEIGHT = bold

FONTSTYLE = roman

COLOR =cx000000

BACKGROUNDCOLOR = cxffffff

FONTFAMILY ="'Times New Roman', 'Times Roman'"

FONTSIZE = 11pt

FONTWEIGHT = bold

FONTSTYLE = roman

COLOR =cx000000

BORDERWIDTH = NaN

GRANDTOTAL

OBSHEADER

HEADER

TOTAL

Header

FONTFAMILY = "'Avenir Next for SAS', Arial, 'Albany AMT', Helvetica, Helv"

FONTSIZE = 2

FONTWEIGHT = bold

FONTSTYLE = roman

COLOR = cx112277

BACKGROUNDCOLOR = cxedf2f9

FONTFAMILY = "Arial, 'Albany AMT’"

FONTSIZE = 8pt

FONTWEIGHT = bold

FONTSTYLE = roman

COLOR =cx000000

BACKGROUNDCOLOR = cxffffff

BORDERWIDTH = NaN

FONTFAMILY ="'Times New Roman', 'Times Roman'"

FONTSIZE = 11pt

FONTWEIGHT = bold

FONTSTYLE = roman

COLOR =cx000000

BACKGROUNDCOLOR = cxbbbbbb

N

Linecontent

FONTFAMILY = "'Avenir Next for SAS', Arial, 'Albany AMT', Helvetica, Helv"

FONTSIZE = 2

FONTWEIGHT = medium

FONTSTYLE = roman

COLOR = cx112277

BACKGROUNDCOLOR = cxfafbfe

FONTFAMILY = "Arial, 'Albany AMT’"

FONTSIZE = 8pt

FONTWEIGHT =medium

FONTSTYLE = roman

COLOR =cx000000

BACKGROUNDCOLOR = cxffffff

BORDERWIDTH = NaN

FONTFAMILY ="'Times New Roman', 'Times Roman'"

FONTSIZE = 10pt

FONTWEIGHT = medium

FONTSTYLE = roman

COLOR =cx000000

OBS

Rowheader

FONTFAMILY = "'Avenir Next for SAS', Arial, 'Albany AMT', Helvetica, Helv"

FONTSIZE = 2

FONTWEIGHT = bold

FONTSTYLE = roman

COLOR = cx112277

BACKGROUNDCOLOR = cxedf2f9

FONTFAMILY = "Arial, 'Albany AMT’"

FONTSIZE = 8pt

FONTWEIGHT = bold

FONTSTYLE = roman

COLOR =cx000000

BACKGROUNDCOLOR = cxffffff

BORDERWIDTH = NaN

FONTFAMILY ="'Times New Roman', 'Times Roman'"

FONTSIZE = 11pt

FONTWEIGHT = bold

FONTSTYLE = roman

COLOR =cx000000

BACKGROUNDCOLOR = cxbbbbbb

DATA

Data

FONTFAMILY = "'Avenir Next for SAS', Arial, 'Albany AMT', Helvetica, Helv"

FONTSIZE = 2

FONTWEIGHT = medium

FONTSTYLE = roman

BACKGROUNDCOLOR = cxffffff

FONTFAMILY ="’Albany AMT’, Albany"

FONTSIZE = 8pt

FONTWEIGHT = medium

FONTSTYLE = roman

COLOR = cx000000

BORDERWIDTH = NaN

COLOR = cx000000

FONTFAMILY ="'Times New Roman', 'Times Roman'"

FONTSIZE = 10pt

FONTWEIGHT = medium

FONTSTYLE = roman

COLOR = cx000000

Titles

SystemTitle

FONTFAMILY = "'Avenir Next for SAS', Arial, 'Albany AMT', Helvetica, Helv"

FONTSIZE = 3

FONTWEIGHT = bold

FONTSTYLE = roman

BACKGROUNDCOLOR = cxfafbfe

FONTFAMILY ="’Albany AMT’, Albany"

FONTSIZE = 11pt

FONTWEIGHT = bold

FONTSTYLE = roman

COLOR = cx000000

BACKGROUNDCOLOR = cxffffff

FONTFAMILY ="'Times New Roman', 'Times Roman'"

FONTSIZE = 13pt

FONTWEIGHT = bold

FONTSTYLE = italic

COLOR = cx000000

Footnotes

Footers

FONTFAMILY = "'Avenir Next for SAS', Arial, 'Albany AMT', Helvetica, Helv"

FONTSIZE = 2

FONTWEIGHT = medium

FONTSTYLE = roman

BACKGROUNDCOLOR = cxffffff

FONTFAMILY ="’Albany AMT’, Albany"

FONTSIZE = 11pt

FONTWEIGHT = bold

FONTSTYLE = roman

COLOR = cx000000

BACKGROUNDCOLOR = cxffffff

FONTFAMILY ="'Times New Roman', 'Times Roman'"

FONTSIZE = 13pt

FONTWEIGHT = bold

FONTSTYLE = italic

COLOR = cx000000

Last updated: September 15, 2026