9.5 Customizing ODS Titles, Footnotes, & Global Options
Key Takeaways
- SAS supports up to 10 active TITLE statements (TITLE1 through TITLE10) and 10 active FOOTNOTE statements (FOOTNOTE1 through FOOTNOTE10).
- Defining a lower-numbered title statement (e.g., TITLE2 'Text';) automatically cancels and clears all higher-numbered titles (TITLE3 through TITLE10).
- Issuing a blank TITLE; or TITLE1; statement clears all active titles; similarly, FOOTNOTE; or FOOTNOTE1; clears all active footnotes.
- Macro variable references embedded inside titles or footnotes (e.g., &SYSDATE) require double quotation marks ("...") to resolve properly; single quotes preserve text literally.
- Global SAS system options (OPTIONS NOCENTER LS= PS= PAGENO= DATE NUMBER) alter global environment settings, though specific ODS destinations may override fixed page layout options.
9.5 Customizing ODS Titles, Footnotes, & Global Options
Report presentation relies heavily on clear headings, page numbers, execution timestamps, and consistent layout formatting. SAS provides global TITLE and FOOTNOTE statements alongside environment system options (OPTIONS) to manage default output aesthetics across both traditional LISTING and modern ODS destinations.
TITLEn and FOOTNOTEn Statements
SAS permits up to 10 lines of titles and 10 lines of footnotes at any given point in a SAS session.
Basic Syntax
TITLE<n> "text-in-quotes";
FOOTNOTE<n> "text-in-quotes";
(where $n$ is an integer from 1 to 10; TITLE without a number is equivalent to TITLE1).
title1 "Acme Corporation";
title2 "Quarterly Financial Analysis";
title3 "Department of Sales";
footnote1 "Confidential - Internal Distribution Only";
footnote2 "Generated on &SYSDATE";
Scoping, Replacement, and Clearing Rules
Titles and footnotes are global statements. Once defined, they remain active for all subsequent procedure output until explicitly modified or canceled.
Rule 1: Higher-Numbered Title Cancellation
When you redefine a title at level $n$, SAS automatically cancels all existing titles numbered greater than $n$.
Step-by-Step Example
/* Initial Setup */
title1 "Main Header";
title2 "Sub Header 2";
title3 "Sub Header 3";
title4 "Sub Header 4";
/* Procedure 1 displays Titles 1, 2, 3, 4 */
proc print data=sashelp.class; run;
/* Redefine Title 2 */
title2 "NEW Sub Header 2";
/* Procedure 2 displays ONLY Title 1 and NEW Title 2!
Title 3 and Title 4 were automatically canceled! */
proc print data=sashelp.class; run;
Rule 2: Clearing All Active Titles or Footnotes
To clear all currently active titles or footnotes, issue a blank statement without text:
/* Clears ALL titles (TITLE1 through TITLE10) */
title;
/* OR */
title1;
/* Clears ALL footnotes (FOOTNOTE1 through FOOTNOTE10) */
footnote;
/* OR */
footnote1;
[!IMPORTANT] To clear a specific title line without clearing higher lines, you must redefine it as a blank string in quotes (e.g.,
TITLE3 "";). IssuingTITLE3;without quotes will cancel Title 3 and all higher titles (Titles 4-10).
Macro Variable Resolution in Titles and Footnotes
Titles and footnotes frequently display dynamic information, such as current execution dates, user IDs, or macro parameters.
To ensure that SAS macro variables (such as &SYSDATE, &SYSDAY, or custom macro variables) resolve to their underlying values, you MUST enclose the title text in double quotation marks ("...").
%let ReportDept = Finance;
/* CORRECT: Double quotes allow macro resolution */
title1 "Department Report: &ReportDept";
title2 "Report Date: &SYSDATE";
/* INCORRECT: Single quotes prevent macro resolution */
title3 'Department Report: &ReportDept';
/* Displays literally as: Department Report: &ReportDept */
| Quote Type | Example | Displayed Result in ODS Report |
|---|---|---|
Double Quotes (") | title "Date: &SYSDATE"; | Date: 07AUG26 (Resolved) |
Single Quotes (') | title 'Date: &SYSDATE'; | Date: &SYSDATE (Literal text) |
Global System OPTIONS for Output Formatting
Global SAS OPTIONS statements control session-wide environment parameters. While ODS visual styles override many legacy text options, several key system options remain critical for certification and report formatting.
Key Report System Options Table
| System Option | Syntax / Range | Default | Purpose & Description |
|---|---|---|---|
CENTER / NOCENTER | OPTIONS NOCENTER; | CENTER | Controls horizontal alignment of titles and procedure output. NOCENTER left-aligns output. |
DATE / NODATE | OPTIONS NODATE; | DATE | Toggles display of session date/time stamps in output headers. |
NUMBER / NONUMBER | OPTIONS NONUMBER; | NUMBER | Toggles display of automatic page numbers in output headers. |
PAGENO= | OPTIONS PAGENO=1; | 1 | Resets or sets the starting page number for subsequent procedure output. |
LINESIZE= (LS=) | OPTIONS LS=80; (64-256) | Varies | Sets maximum character line width for output. |
PAGESIZE= (PS=) | OPTIONS PS=60; (15-500) | Varies | Sets maximum lines per page for text output. |
Code Example: Combining System Options and ODS
/* Configure global environment options */
options nocenter nodate pageno=1 ls=100 ps=50;
ods pdf file="C:\reports\CustomFormatted.pdf" style=Pearl;
title1 "Executive Summary";
title2 "Generated for &SYSUSERID on &SYSDATE";
footnote1 "Page ~{thispage}";
proc report data=sashelp.prdsale;
column Region Product Sales;
define Region / group;
run;
ods pdf close;
ODS Interaction with Global System Options
It is important to recognize how different ODS destinations interact with global SAS system options:
- Paged Destinations (ODS PDF, ODS RTF, ODS PRINTER): Respect
PAGENO=,DATE,NUMBER, and title/footnote definitions. Page size is primarily controlled by physical page margins andPAPERSIZE=options rather than characterPAGESIZE=. - Unpaged Destinations (ODS HTML, ODS EXCEL): Ignore fixed page height options (
PAGESIZE=) because web pages and spreadsheets scroll continuously. However, they respectTITLE,FOOTNOTE, and alignment settings likeNOCENTER.
Consider the following SAS code executed in sequence:
Which titles appear on the output of the second PROC PRINT step?title1 "Company Sales";
title2 "North America Region";
title3 "Q4 Report";
proc print data=sales; run;
title2 "Global Operations";
proc print data=sales; run;
A programmer wants to display the dynamic macro variable value &SYSDATE in Title 1 and left-align the procedure output across the report. Which SAS statements achieve this?
How can a programmer clear all currently active titles and footnotes in a SAS session?
Which global SAS system option is used to reset the page numbering of subsequent procedure output to start at page 1?