ODS TEXT= Statement

Inserts text into your ODS output.
Valid in: Anywhere
Category: ODS: Output Control
Tip: The ODS TEXT= statement is sent only to output destinations that are open. Therefore, it must be specified after an ODS destination statement.

Syntax

ODS TEXT= 'text-string'

Required Argument

text-string
specifies the text to insert into your output. This text is sent to all open supported output destinations.
Restriction:The ODS TEXT= statement does not support the OUTPUT destination or the LISTING destination. All other ODS destinations are supported.
Requirement:You must enclose 'text-string' in parentheses.
Tip:The UserText style element controls text specified with the TEXT= statement.

Example: Adding Text to Multiple Destinations

Features:

ODS HTML statement

ODS PDF statement

ODS RTF statement

ODS TEXT= statement

PROC TEMPLATE::
DEFINE STYLE statement
PARENT= statement
STYLE statement
Other features:

PROC PRINT

Data set: Exprev

Details

The following example uses a single ODS TEXT= statement to add text to PDF, HTML, and traditional RTF output. PROC TEMPLATE modifies the UserText style element which controls the font style, font color, and other attributes of the text that the ODS TEXT= statement adds.

Program

options obs=10;
proc template;
   define style mystyle;
   parent=styles.htmlblue;
   style usertext from usertext /
      foreground=red;
   end;
run;
ods html file="text.html" style=mystyle;
ods pdf file="text.pdf" startpage=never notoc style=mystyle;
ods rtf file="text_trad.rtf" style=mystyle;
title "January Orders ";
footnote " For All Employees";
ods text="My Text 1";
ods text="My Text 2"; 
proc print data=exprev;
run;
ods text="My Text 3"; 
ods pdf close;

ods rtf close;

title;
footnote;
proc template;
   delete mystyle;
   run;

Program Description

options obs=10;
Create the MyStyle style template. The MyStyle style templates modifies the Usertext style element to change the font color of text created by the TEXT= statement to red.
proc template;
   define style mystyle;
   parent=styles.htmlblue;
   style usertext from usertext /
      foreground=red;
   end;
run;
Send output to multiple ODS destinations. The following statements open the HTML, PDF, and RTF destinations.
ods html file="text.html" style=mystyle;
ods pdf file="text.pdf" startpage=never notoc style=mystyle;
ods rtf file="text_trad.rtf" style=mystyle;
Add a title and footnote. The TITLE and FOOTNOTE statements specify the title and footnote. You must place the TITLE and FOOTNOTE statements before the ODS TEXT= statements.
title "January Orders ";
footnote " For All Employees";
Add text strings before the output is printed. The ODS TEXT= statements add the text strings “My Text 1” and “My Text 2” The text is added to the output before the data set is printed.
ods text="My Text 1";
ods text="My Text 2"; 
Print the data set Exprev. The PRINT procedure prints the Exprev data set.
proc print data=exprev;
run;
Add a third text string after the data set. The third ODS TEXT= statement adds the text string “My Text 3” after the data set is printed.
ods text="My Text 3"; 
Close the RTF and PRINTER destinations and remove the titles and footnotes. The ODS RTF CLOSE statement closes the RTF destination. The ODS PDF CLOSE statement closes the PRINTER destination. The TITLE and FOOTNOTE statements remove any titles and footnotes previously specified.
ods pdf close;

ods rtf close;

title;
footnote;
Delete the MyStyle style template. The DELETE statement deletes the MyStyle style template.
proc template;
   delete mystyle;
   run;

Output

HTML Output with Text Added
HTML Output with Text Added
PDF Output with Text Added
PDF Output with Text Added
Traditional RTF Output with Text Added
Traditional RTF Output with Text Added