ODS TAGSETS.RTF Statement

Opens, manages, or closes the RTF destination, which produces measured output that is written in Rich Text Format for use with Microsoft Word 2002.
Valid in: Anywhere
Category: ODS: Third-Party Formatted
Interaction: By default, when you execute a procedure that uses the FORMCHAR system option (for example, PROC PLOT or PROC CHART), ODS formats the output in SAS Monospace font. If you are creating output that will be viewed in an operating environment that does not have SAS software installed, this output will not be displayed correctly. The SAS Monospace font is not recognized if SAS is not installed. For the correct display of your document, include the following statement before your SAS program:
OPTIONS FORMCHAR='|----|+|---+=|-/\<>*'; 
Tip: Microsoft Word 2002 is the current official minimum level that is supported. However, no problems have been found with Microsoft Word 2000 and SAS RTF files.

Syntax

ODS TAGSETS.RTF <(<ID=> identifier)> action;
ODS TAGSETS.RTF <(<ID=> identifier)> <option(s)> ;

Summary of Optional Arguments

Open multiple instances of the same destination at the same time
Specify a unique base name for the anchor tag that identifies each output object in the current body file
Specify the text string that identifies the author. This text string is inserted into the metadata of a file.
Specify text to use as the first part of all links and references that ODS creates in output files
Close the destination and the file that is associated with it
Specify the number of columns to create on each page of output
Specify a cascading style sheet to apply to your output
Specify a device for the RTF output destination
Override the encoding for input or output processing (transcodes) of external files
Exclude output objects from the destination
Open the ODS RTF destination and specify the name of the file to which to write information
Specify the location where footnotes are printed in the graphics output
Control the location where titles are printed in the graphics output
Specify the image resolution for the graphical output
Control where tables split on a page
Create a new body file at the specified starting point
Suppress currently defined footnotes in the graphics file. They appear in the RTF file instead
Suppress currently defined titles in the graphics file. They appear in the RTF file instead
Insert the text that you specify into the metadata of the RTF file
Specify TAGSETS.RTF-specific options
Specify that the output from the destination be added to an ODS package
Specify the number of panels that will be rendered for a multipanel table
Specify the location of an aggregate storage location or a SAS catalog for all RTF files
Specify a text string that occurs before a table on a page
Specify an alternative character or string to separate lines in the output files
Select output objects for the destination
Write to the SAS log the current selection or exclusion list for the destination
Control page breaks
Specify a style definition to use in writing the RTF files
Specify the number of rows that will be rendered in a table
Insert text into your RTF output
Insert the text string that you want as your title into the metadata of a file
Specify a translation table to use when you transcode a file for output
Specify that every page of a table is formatted the same

Actions

The following actions are available for the ODS TAGSETS.RTF statement:

CLOSE
closes the destination and any files that are associated with it. For Printer destinations, you cannot print the file until you close the destination.
Tip:When an ODS destination is closed, ODS does not send output to that destination. Closing an unneeded destination conserves system resources.
EXCLUDE exclusion(s)| ALL | NONE
excludes one or more output objects from the destination.
Default:NONE
Restriction:A destination must be open for this action to take effect.
SELECT selection(s) | ALL | NONE
selects output objects for the specified destination.
Default:ALL
Restriction:A destination must be open for this action to take effect.
SHOW
writes the current selection list or exclusion list for the destination to the SAS log.
Restriction:The destination must be open for this action to take effect.
Tip:If the selection or exclusion list is the default list (SELECT ALL), then SHOW also writes the entire selection or exclusion list. For information about selection and exclusion lists, see Selection and Exclusion Lists.

Optional Arguments

ANCHOR= 'anchor-name'
specifies the base name for the RTF anchor tag that identifies each output object in the current file.
Each output object must have an anchor tag to which other files will link or reference. The references, which ODS automatically creates, point to the name of an anchor. Therefore, each anchor name in a file must be unique.
anchor-name
is the base name for the RTF anchor tag that identifies each output object in the current file.
ODS increments the name that you specify and creates unique anchor names. For example, if you specify ANCHOR= 'tabulate', then ODS names the first anchor tabulate. The second anchor is named tabulate1; the third is named tabulate2, and so on.
Requirement:You must enclose anchor-name in quotation marks.
Alias:NAMED_DEST= | BOOKMARK=
Tips:It is useful to specify new anchor names at various points in your program when you want other RTF files to link to specific parts of your RTF output. Because you can control where the anchor name changes, you know in advance what the anchor name will be at those points.

You can change anchor names as often as you want by submitting the ANCHOR= option in an ODS RTF statement anywhere in your program. After you specify an anchor name, it remains in effect until you specify a new one.

AUTHOR= 'author-text'
inserts the text string that you specify as the author into the metadata of a file.
author-text
is the text in the metadata of an open file that indicates the author.
Requirement:You must enclose author-text in quotation marks.
BASE= 'base-text'
specifies the text to use as the first part of references that ODS creates in the output file.
base-text
is the text that ODS uses as the first part of all references that ODS creates in the file.
Consider this specification:
BASE='http://www.your-company.com/local-url/'
In this case, ODS creates links that begin with the string http://www.your-company.com/local-url/.
Requirement:You must enclose base-text in quotation marks.
COLUMNS= n | MAX
specifies the number of columns to place across each page of output.
n
is the number of one-inch columns that you want on the page.
MAX
specifies the maximum number of one-inch-wide columns for the paper size and margin setting. This value is dependent upon the paper size and page orientation.
Default:The number of one-inch columns that fit on the page
Interaction:When you specify the COLUMNS= option, the STARTPAGE=NO option will not be honored.
Tips:Titles are considered tables and not RTF instructions in Measured RTF (ODS TAGSETS.RTF statement). When you use the COLUMNS= option with Measured RTF, titles will appear at the top of each column. However, ODS truncates the titles to fit the column width.

If you specify a value greater than the maximum number of one inch columns that can fit on the page, a note is printed to the SAS log that states what the maximum value can be for that page.

CSSSTYLE= 'file-specification'<(media-type-1 media-type-10>)>
specifies a cascading style sheet to apply to your output.
file-specification
specifies a file, fileref, or URL that contains CSS code.
file-specification is one of the following:
"external-file"
is the name of the external file.
Requirement:You must enclose external-file in quotation marks.
fileref
is a file reference that has been assigned to an external file. Use the FILENAME statement to assign a fileref.
See:For information about the FILENAME statement, see SAS Statements: Reference.
URL
is a URL to an external file.
Requirement:You must enclose external-file in quotation marks.
(media-type-1<… media-type-10>)
specifies one or more media blocks that correspond to the type of media to which your output will be rendered. CSS uses media type blocks to specify the different media on which a document is to be presented: on the screen, on paper, with a speech synthesizer, with a braille device, and so on.
ODS adds the media block to your output in addition to the CSS code that is not contained in any media blocks. By using the media-type suboption and the general CSS code, you can import the section of a CSS file intended only for a specific media type.
Default:If you do not specify a media-type in your ODS statement, but you do specify media types in your CSS file, ODS uses the Screen media type.
Range:You can specify up to ten different media types.
Requirements:You must enclose media-type in parentheses.

You must specify media-type next to the file-specification specified by the CSSSTYLE= option.

Tip:If you specify multiple media types, ODS applies all of the style information in all of the media types to your output. However, if there is duplicate style information in different media blocks, then ODS uses the styles from the last media block.
Requirement:CSS files must be written in the same type of CSS produced by the ODS HTML statement. Only class names are supported, with no IDs and no context-based selectors. To view the CSS code that ODS creates, you can do one of the following:
  • Specify the STYLESHEET= option.
  • View the source of an HTML file and look at the code between the <STYLE> </STYLE> tags at the top of the file.
For an example of a valid ODS CSS file, see Applying a CSS File to ODS Output.
Interaction:If you specify both the STYLE= option and the CSSSTYLE= option on an ODS statement, ODS uses the last option that you specified.
DEVICE= device-driver
specifies the name of a device driver. ODS automatically selects an optimal default device for each open output destination.
The following table lists default devices for the most common ODS output destinations.
The following table lists the default devices for the most common ODS output destinations. These default devices are used when graphics are created using SAS/GRAPH or ODS Graphics. For a complete list of supported devices and file types, see Supported File Types for Output Destinations.
Default Devices for ODS Output Destinations
Output Destination
Default Device
HTML
PNG
LISTING
PNG
Measured RTF
PNG
RTF
PNG
PCL
Scalable Vector Graphics (SVG)
PDF
Scalable Vector Graphics (SVG)
POSTSCRIPT
PNG
PRINTER
Host Specific Default Printer
Markup Tagsets
All markup family tagsets have the default value built in.
Restriction:When you specify a device in an ODS destination statement, do not specify the ACTIVEX, ACTXIMG, JAVA, or JAVAIMG devices.
Tip:Specifying a device on the ODS DEVICE= option takes precedence over the SAS global option and the graphics option.
See:DEVICE= System Option in SAS System Options: Reference. For information about selecting device drivers, see Using Graphics Devices in SAS/GRAPH: Reference.
ENCODING= local-character-set-encoding
overrides the encoding for input or output processing (transcodes) of external files.
See:For information about the ENCODING= option, see SAS National Language Support (NLS): Reference Guide.
FILE= 'external-file' | fileref
opens the RTF destination and specifies the RTF file or SAS catalog to which to write. This file remains open until you do one of the following actions:
  • Close the RTF destination with ODS RTF CLOSE or ODS _ALL_ CLOSE.
  • Specify a different file to which to write.
external-file
is the name of an external file to which to write.
Requirement:You must enclose external-file in quotation marks.
fileref
is a file reference that has been assigned to an external file. Use the FILENAME statement to assign a fileref.
Restriction:You cannot use the FILE=fileref option with the NEWFILE= option.
See:The section on statements in SAS Statements: Reference for information about the FILENAME statement.
Alias:BODY=
Interaction:In an ODS RTF statement that refers to an open RTF destination, the FILE= option forces ODS to close the destination and all files that are associated with it, and to open a new instance of the destination. For more information, see Opening and Closing the RTF Destination .
See:NEWFILE= option
GFOOTNOTE | NOGFOOTNOTE
controls the location of the footnotes that are defined by the graphics program that generates the RTF output.
GFOOTNOTE
includes all of the currently defined footnotes within the graphics output.
NOGFOOTNOTE
prevents all of the currently defined footnotes from appearing in the graphics file. Instead, they become part of the RTF file.
Default:GFOOTNOTE
Restriction:This option applies only to SAS programs that produce one or more device-based graphics, or graphics created by the SGPLOT procedure, the SGPANEL procedure, or the SGSCATTER procedure.
GTITLE | NOGTITLE
controls the location of the titles that are defined by the graphics program that generates the RTF output.
GTITLE
includes all of the currently defined titles within the graphics output that is called by the body file.
NOGTITLE
prevents all of the currently defined titles from appearing in the graphics output. Instead, the titles become part of the RTF file.
Default:GTITLE
Restriction:This option applies only to SAS programs that produce one or more device-based graphics, or graphics created by the SGPLOT procedure, the SGPANEL procedure, or the SGSCATTER procedure.
(ID= identifier)
identifier
can be a number or a series of characters that begin with a letter or an underscore.
Restriction:If identifier is a number, the number must be positive.
Requirement:You must specify the ID= option immediately after the destination name.
Tip:You can omit the ID= option, and use a name or a number instead to identify the instance.
IMAGE_DPI
specifies the image resolution for graphical output.
Default:96
KEEPN | NOKEEPN
controls where tables split on a page.
KEEPN
ODS allows table splits only if the entire table cannot fit on one page.
NOKEEPN
ODS lets a table split at a page break.
Tip:Although KEEPN minimizes page breaks in tables, it might use substantially more paper than NOKEEPN. This is because the KEEPN option issues a page break before starting to print any table that does not fit on the remainder of the page.
NEWFILE= starting-point
creates a new file at the specified starting-point.
starting-point can be one of the following:
BYGROUP
starts a new file for the results of each BY group.
NONE
writes all output to the body file that is currently open.
OUTPUT
starts a new file for each output object. For SAS/GRAPH this means that ODS creates a new file for each SAS/GRAPH output file that the program generates.
Alias:TABLE
PROC
starts a new file each time you start a new procedure.
Default:NONE
Restrictions:You cannot use both the NEWFILE= and TEXT= options in the same ODS RTF statement. You must use a separate ODS RTF statement for each of these options.

You cannot use the NEWFILE= option with the FILE=fileref option.

Tip:If you end the filename with a number, then ODS begins incrementing with that number. In the following example, ODS names the first body file MAY5.XML, and names additional body files MAY6.XML, MAY7.XML, and so on.
NOGFOOTNOTE
See the description of GFOOTNOTE | NOFOOTNOTE in this section.
NOGTITLE
See the description of GTITLE | NOGTITLE in this section.
OPERATOR= 'text-string'
inserts the text that you specify into the metadata of the RTF file.
text-string
is the text in the metadata of a file that indicates the author.
Requirement:You must enclose text-string in quotation marks.
OPTIONS (CONTENTS= | CONTINUE_TAG= | DOC= | SECT= | TABLES_OFF= | TOC_DATA= | TOC_LEVEL= | TROWD= | TRHDR= | TROWHDRCELL= | WATERMARK=)
specifies ODS TAGSETS.RTF-specific suboptions and a named value.
(CONTENTS= 'YES')
produces a table of contents (TOC) page for RTF documents that are opened in Microsoft Word. The table of contents page contains a Table of Contents field that puts all of the contents information that is embedded in the document into a table of contents.To display the captured TOC data, you must turn on the option TOC_DATA. To expand the table of contents, right-click under the title in Microsoft Word and select Update Field from the selection list.
Note: From Microsoft Word, you might need to right-click lower on the page to get the Update Field value to appear in the selection list.
YES
adds a table of contents page to the top of the RTF file. This table of contents page is followed by a page break.
Alias:ON
Requirement:All values must be enclosed in quotation marks.
Tips:To go to a specific topic in the document you can double-click or hold down the CTRL key and click on the topic in the table of contents. You might have to configure Microsoft Word to use the CTRL key method. Select Toolsthen selectOptionsthen selectEdit and then select Use CTRL + Click to follow hyperlink.

The TOC_DATA option must be set to YES to capture TOC data. If you specify CONTENTS=YES, but you do not specify TOC_DATA, no Table of Contents data is captured. The error displayed on the Table of Contents page is "Error! No table of contents entries found".

See:TOC_DATA suboption for details about displaying the contents embedded in the document.
(CONTINUE_TAG ='ON' | 'OFF')
specifies whether to add a continue tag to the RTF file when a table breaks and is continued to the next page.
ON
instructs ODS to add a continue tag to the RTF file when a table breaks and is continued to the next page.
Alias:YES
OFF
instructs ODS not to add the continue tag when a table breaks and is continued to the next page.
Alias:NO
Requirement:You must enclose all values in quotation marks.
(DOC='QUICK' | 'HELP' | 'SETTINGS')
provides information about the tagset.
QUICK
describes the options available for this tagset.
HELP
provides generic help and information with a quick reference.
SETTINGS
provides the current option settings.
Requirement:All values must be enclosed in quotation marks.
(SECT='rtf_control_string' | 'OFF' | 'NONE')
inserts RTF control words into the section data specifications.
rtf_control_string
specifies RTF control words used to format the section data.
OFF
turns off the usage of RTF control words for the section data and resets the rtf_control_string to null.
Alias:NO
NONE
stops new RTF control words from being inserted into the file for the section data. ODS continues to use the section data information that was set before the use of NONE until it is reset.
Requirement:All values must be enclosed in quotation marks.
Tip:To reset the rtf_control_string, assign a different value or use the OFF or NO values.
See:Rich Text Format (RTF) Specification, version 1.6 available on the MSDN home Web page for information about RTF control words. Simply search for the document.
(TABLES_OFF='style_elements' | 'STYLE_ELEMENTS' | 'OFF' )
determines whether tables will be used. A table can consist of one cell or many cells. SAS puts all of the text that you create into tables for RTF output. Use this suboption for tables that are text holders like titles, footnotes, and TEXT=. You should not use this suboption for tables produced by reporting procedures.
Note: To view the gridlines of tables in Microsoft Word, select Show Gridlines from the Table drop-down menu.
style_elements
specifies the style element for formatting. For example, the following statement turns off tables that use the USERTEXT style element. The text specified by the TEXT= option is not placed in the table.
ods tagsets.rtf options (Tables_OFF='usertext');
ods tagsets.rtf text=”Text is not placed in a table”);
STYLE_ELEMENTS
lists the output style elements in the SAS log.
OFF
turns the option off. Therefore, ODS places the information output next into the RTF file inside a table. This action is the default option.
Alias:NO
Requirement:You must enclose all values in quotation marks.
See:General ODS Style Elements for information about style elements
(TOC_DATA ='ON' | 'OFF')
specifies whether to show the contents data in the RTF file.
OFF
instructs ODS not to display the table of contents data in the RTF file.
Alias:NO
ON
instructs ODS to display the hidden text of the table of contents in the RTF file.
Alias:YES
Requirement:You must enclose all values in quotation marks.
(TOC_LEVEL ='n')
controls the level of the expansion of the table of contents in RTF documents. This option must be used with the (CONTENTS=YES) and (TOC_DATA=YES) options specified.
n
specifies the level of expansion. For example, TOC_LEVEL=”0” results in a fully expanded table of contents, while TOC_LEVEL=”2” results in a table of contents that is expanded to two levels.
OFF
restores all levels of expansion that are shown in the Table of Contents.
Alias:NO
Requirement:You must enclose all values in quotation marks.
Tip:The TOC_DATA= and the CONTENTS= suboptions must be set to YES to capture TOC data. For more information on viewing the TOC, see Creating a Table of Contents.
See:TOC_DATA= and the CONTENTS= suboption for details about displaying the contents embedded in the document.
(TROWD='rtf_control_string' | ' OFF')
inserts raw RTF specifications directly into header descriptions of the table row.
rtf_control_string
specifies RTF control words and symbols.
OFF
RTF controls are no longer inserted.
Alias:NO
Requirement:You must enclose all values in quotation marks.
Tip:If the RTF code inserted in the document is invalid, the code will either be ignored or will cause the document to be unusable.
See:Rich Text Format (RTF) Specification, version 1.6 available on the MSDN home Web page for information about RTF control words. Search for the RTF 1.6 document.
(TRHDR='rtf_control_string' | 'OFF')
inserts raw table row RTF specifications directly into the header description of the table row.
rtf_control_string
specifies Microsoft RTF control words or symbols.
OFF
RTF controls are no longer inserted.
Alias:NO
Requirement:You must enclose all values in quotation marks.
Tip:If the RTF code inserted in the document is invalid, the code will either be ignored or will cause the document to be unusable.
See:Rich Text Format (RTF) Specification, version 1.6 available on the MSDN home Web page for information about RTF control words. Search for the RTF 1.6 document.
(TROWHDRCELL='text_string' | 'OFF')
inserts raw text into the table row cells. If the RTF Reader does not recognize this text_string, it applies the raw text to the location where the RTF is being written in the documentation. Otherwise, the RTF Reader interprets the text_string as RTF control words.
text_string
any text specified.
OFF
inserts a null string. Text is no longer inserted.
Alias:NO
Requirement:You must enclose all values in quotation marks.
See:Rich Text Format (RTF) Specification, version 1.6 available on the MSDN home Web page for information about RTF control words. Search for the RTF 1.6 document.
(WATERMARK='text_string ' | ' ')
inserts a watermark that is displayed diagonally across each page of the RTF document.
text_string
specifies the text string that appears diagonally across each page of the RTF document.
' '
turns off the watermark text. Use a blank character within the quotes.
Restriction:To turn off the watermark, you must use a blank space within the quotes. Empty quotes will not turn off the watermark.
Requirement: WATERMARK='text_string ' | ' ' must be enclosed in parentheses.
PACKAGE <package-name>
specifies that the output from the destination be added to a package.
package-name
specifies the name of a package that was created with the ODS PACKAGE statement. If no name is specified, then the output is added to the unnamed package that was opened last.
PAGEPANELS= n | NONE
specifies the number of panels permitted per page before ODS inserts a page break.
n
specifies a positive integer.
Default:0
Tip:Setting the value to 0 resets the action to the default action.
NONE
specifies that paneling will be handled the way that it has always been handled by traditional ODS RTF. That is, all of the first panel is written, then all of the second panel, and so on, until all of the table information is written.
Default:If you do not specify paneling, ODS tries to fit the full set of panels on a single page. ODS measures the width of the text and tables (horizontal measurement) and determines what the column widths should be. ODS then divides the page into panels if it is too wide to fit on a page.

ODS always determines the column widths and determines whether panels are required. When there are multiple panels, ODS attempts to place a reasonable number of rows in each panel.

PATH= 'aggregate-file-storage-specification' | fileref | libref.catalog (URL= 'Uniform-Resource-Locator' | NONE)
specifies the location of an aggregate storage location or a SAS catalog for all RTF files. If the GPATH= option is not specified, all graphics output files are written to the “aggregate-file-storage-specification” or libref.
'aggregate-file-storage-location'
specifies an aggregate storage location such as directory, folder, or partitioned data set.
Requirement:You must enclose aggregate-file-storage-location in quotation marks.
fileref
is a file reference that has been assigned to an aggregate storage location. Use the FILENAME statement to assign a fileref.
Interaction:If you use a fileref in the PATH= option, then ODS does not use information from PATH= when it constructs links.
See:FILENAME Statement in SAS Statements: Reference.
libref.catalog
specifies a SAS catalog to write to.
See:LIBNAME Statement in SAS Statements: Reference.
URL= 'Uniform-Resource-Locator' | NONE
specifies a URL for the file-specification.
Uniform-Resource-Locator
is the URL that you specify. ODS uses this URL instead of the filename in all the links and references that it creates to the file.
NONE
specifies that no information from the PATH= option appears in the links or references.
Tip:This option is useful for building output files that can be moved from one location to another. The links from the contents and page files must be constructed with a single-name URL, and the contents, page, and body files must be in the same location.
Interaction:If you use the BODY= or FILE= external file option in conjunction with the PATH= option, the external file specification should not include path information.
PREPAGE='text-string'
specifies a text string that occurs before a table on a page.
text-string
is the text at the top of the table, after the titles. The text is placed before any tables created by the procedure.
Requirement:You must enclose text-string in quotation marks.
RECORD_SEPARATOR= 'alternative-separator' | NONE
specifies an alternative record separator, which is a character or string that separates lines in the output files.
Different operating environments use different separator characters. If you do not specify a record separator, ODS formats the RTF files for the environment in which you run the SAS job. However, if you are generating files in one operating environment to view in another operating environment that uses a different separator character, you can specify a record separator that is appropriate for the target environment.
alternative-separator
represents one or more characters in hexadecimal or ASCII format. For example, the following option specifies a record separator of a carriage-return character and a linefeed character (on an ASCII file system):
RECORD_SEPARATOR= '0D0A'x
Operating Environment Information: In a mainframe environment, the following option specifies a record separator for a carriage-return character and a linefeed character for use with an ASCII file system:
RECORD_SEPARATOR= '0D25'x
Requirement:You must enclose alternative-separator in quotation marks.
NONE
produces RTF output that is appropriate for the environment in which you run the SAS job.
Operating Environment Information: In many operating environments, using a value of NONE has the same result as omitting the RECORD_SEPARATOR option.
Operating Environment Information: In a mainframe environment, by default, ODS produces a binary file that contains embedded record-separator characters. This approach means that the file is not restricted by the line-length restrictions on ASCII files. However, this also means that the lines are concatenated if you view the file in an editor. If you want to format the RTF files in a manner that enables you to read them with an editor, use RECORD_SEPARATOR= NONE. In this case, ODS writes one line of RTF at a time to the file. When you use a value of NONE, the logical record length of the file to which you are writing must be at least as long as the longest line that ODS produces. Otherwise, RTF might wrap to another line at an inappropriate place.
Aliases:RECSEP=

RS=

STARTPAGE= BYGROUP | YES | NO | NOW
controls page breaks.
BYGROUP
specifies to insert page breaks after each BY group.
YES
inserts a new page at the start of each procedure and within certain procedures, as is requested by the procedure code.
Alias:ON
Interactions:When the STARTPAGE= option is set to YES (the default), ODS inserts a new page at the start of each procedure and relies on Word for the correct placement of headers and footers before and after the procedures. When you specify BODYTITLE, titles and footnotes are removed from the header and footer sections of the RTF document. Titles and footnotes are then placed into the body of the document, and they are appended to every TABLE. Therefore, when you set the STARTPAGE= option to YES and you specify the BODYTITLE option, the titles and footnotes might not repeat on every page. For example, if there is a table that spans multiple pages, the title will appear on only the first page, and the footnote will appear on only the last page.

Note that when you specify the BODYTITLE= option, Microsoft Word no longer controls the placement of the headers and footers text. However, Word still controls other header and footer information, such as page number and date.

NO
instructs ODS not to insert any new pages at the start of each procedure or within certain procedures, even if the procedure code requests new pages. A new page begins only when a page is filled or when you specify STARTPAGE= NOW.
Alias:NEVER
Interaction:When you specify the COLUMNS= option, the STARTPAGE=NO option is not honored.
Tip:This option prints only the first set of titles and the first set of footnotes to the RTF file.
NOW
forces the immediate insertion of a new page.
Tip:This option is useful primarily when the current value of the STARTPAGE= option is NO. Otherwise, each new procedure forces a new page automatically.
Default:YES
Tip:Specifying STARTPAGE= NO prevents forced page breaks. You can turn on forced page breaking again by specifying STARTPAGE=YES. You can insert a page break at any time by specifying STARTPAGE=NOW.
STYLE= style-definition
specifies the style definition for ODS to use to write the RTF files.
style-definition
describes how to display the presentation aspects (color, font face, font size, and so on) of your SAS output. A style definition determines the overall appearance of the documents that use that style definition. Each style definition consists of style elements.
See:For a complete discussion of style definitions, see TEMPLATE Procedure: Creating a Style Template.
Default:If you do not specify a style definition, ODS uses the file that is specified in the SAS registry subkey: ODSthen selectDESTINATIONSthen selectRTF. By default, this value specifies RTF for traditional RTF and Measured RTF.
TABLEROWS= n
specifies the number of rows in each table before ODS inserts a page break. If the table is narrow enough to fit on a page, n lines will be written to the table before a page break. If the table is too wide for a page, the page is broken into panels. In each panel, n rows will be written. When all the panels for n rows have been written, a page break is inserted before the next group of panels is written.
Note: Page breaks are not forced between panels.
n
is a positive integer.
Alias:0 | NONE
Default:Allow SAS to determine the number of rows per table.
Tip:0 or NONE returns to the default, which allows SAS to determine the number of rows per table.
TEXT= 'text-string'
inserts text into your RTF output.
text-string
is the text that you want to insert into your RTF output. You can also use TEXT= to annotate other output.
Restriction:You cannot use both the NEWFILE= and TEXT= options in the same ODS RTF statement. You must use a separate ODS RTF statement for each of these options.
Requirement:You must enclose a text-string in quotation marks.
TITLE= 'title-text'
inserts the text string that you specify as the title into the metadata of a file.
title-text
is the text in the metadata of a file that indicates the title.
Requirement:You must enclose a title-text in quotation marks.
TRANTAB= translation-table
specifies the translation table for ODS to use when it transcodes a file for output.
See:For more information, see TRANTAB= System Option in SAS National Language Support (NLS): Reference Guide.
UNIFORM
ensures uniformity from page to page within a single table that requires multiple pages. When the UNIFORM option is in effect, ODS reads the entire table before it starts to print it and determines the column widths that are necessary to accommodate all of the data. ODS applies these column widths to all pages of a multiple page table.
Note: With BY-group processing, SAS writes the results of each BY group to a separate table, so the output might not be uniform across BY groups.
Default:If you do not specify the UNIFORM option, ODS prints a table one page at a time. This approach ensures that SAS does not run out of memory while it processes very large tables. However, column widths might vary from one page to the next.
Tips:After this option is turned on, you cannot turn it off for that SAS session.

The UNIFORM option can cause SAS to run out of memory if you are printing a very large table. If this happens, you can specify the width of each of the columns in the table. Then print the table one page at a time. To do so, you must edit the table definition that you use. For more information, see What You Can Do with a Table Template .

Diagnostic Tagsets

The following diagnostic tagsets are available for the ODS TAGSET.RTF statement.

MEAS_EVENT_MAP
creates XML output that shows which events are being triggered and which variables are used by an event to send output from a SAS process to an output file. When you run a SAS process with MEAS_EVENT_MAP, ODS writes XML to an output file that shows all event names and variable names as tags. The output helps you to create your own tagsets.
MEAS_SHORT_MAP
creates a subset of the XML output that is created by the MEAS_EVENT_MAP tagset.
MEAS_TEXT_MAP
creates text output that shows which events are being triggered as ODS handles the output objects.
Tip:You can use the MEAS_TEXT_MAP output as an alternative to the output that is created by the MEAS_EVENT_MAP tagset.

Details

Opening and Closing the ODS TAGSETS.RTF Destination

You can modify and open an RTF destination with many ODS TAGSETS.RTF options. However, the FILE= option automatically closes the open destination that is referred to by the ODS TAGSETS.RTF statement. The option also closes any files associated with it and opens a new instance of the destination. If you use one of the ODS TAGSETS.RTF options, you should close the destination yourself.

Understanding How Traditional RTF Formats Output

RTF produces output for Microsoft Word 2002. Although other applications can read RTF files, the RTF output might not work successfully with them.
The RTF destination enables you to view and edit the RTF output. ODS does not define the “vertical measurement,” which means that SAS does not determine the optimal place to position each item on the page. For example, page breaks are not always fixed because you do not want your RTF output tables to split at inappropriate places. Your tables can remain intact on one page, or can have logical breaks where you specify.
Microsoft Word needs to know the widths of table columns, and it cannot adjust tables if they are too wide for the page. However, ODS measures the width of the text and tables (horizontal measurement). Therefore, all the column widths can be set properly by SAS, and the table can be divided into panels if it is too wide to fit on a single page.
In short, when producing RTF output for input to Microsoft Word, SAS determines the horizontal measurement and Microsoft Word controls the vertical measurement. Because Microsoft Word can determine how much room there is on the page, your tables will display consistently even after you modify your RTF file.
Note: The creation of complex tables that contain a large number of observations can reduce system efficiencies and increase processing time.

ODS Measured RTF versus Traditional ODS RTF

The ODS RTF tagset (ODS TAGSETS.RTF), which is also referred to as the measured tagset, is new for SAS 9.2. This tagset enables users to specify how and where page breaks occur and when to place titles and footnotes into the body of a page. Traditional ODS RTF relies on Microsoft Word to make implicit page breaks for tables that are too long to fit on a single page. Traditional RTF also places titles and footnotes in the RTF instructions that enable Microsoft Word to apply them to pages as they are needed. In contrast, the RTF tagset enables SAS to place titles and footnotes into the body of the document so that it is outside of the control of Microsoft Word. Therefore, SAS becomes responsible for the implicit page breaks.

RTF Tagset Features

Overview of the RTF Tagset Features

The new “measured” RTF tagset does the following:
  • controls page breaks on very large tables
  • supports RTF readers other than Microsoft Word
  • controls titles, footnotes, and other page elements

Controlling Page Breaks in Long Tables

Multiple-page tables can be a problem for ODS RTF. Like the ODS PRINTER destinations, SAS determines where to wrap a wide table. But for a long table, the entire table is loaded into memory before being rendered. When tables become longer than a physical page, Microsoft Word determines the page break. Microsoft word re-creates the column heading information in the table and applies titles and footnotes as needed. If a table is later edited in Microsoft Word, the information remains valid.
Unfortunately, a lot of information is associated with each cell of a table. No matter how much memory is added to the system, it is possible to create a table that can exceed it. Furthermore, an exhausted memory condition cannot be anticipated because it varies with the machine setup and with the table that you are creating.
However, with the ODS RTF tagset, SAS determines where to break the page and puts the titles and footnotes in the body of the document. When the table is broken into pages and SAS controls the page breaks, approximately a page of data is needed in memory at any one time. Therefore, a much smaller memory footprint is consumed and extremely large tables can be created. The ODS RTF tagset accommodates users who need large tables and users who want the old style RTF behavior. Both RTF implementations can be supported simultaneously.

Supporting RTF Readers Other than Word

Before SAS 9.2, the traditional RTF architecture supported only the Microsoft Word RTF. The problem with supporting multiple readers is that RTF readers interpret the RTF specification in different ways. Now with the RTF tagset, you can enable subtle changes in one reader without impacting another RTF reader.

Controlling Titles, Footnotes, and Other Page Elements

Measured RTF uses a tagset that places the titles and footnotes on the page as tables instead of as RTF control words that are passed to Microsoft Word. With traditional RTF, the titles and footnotes are placed in the RTF header and footer information unless you specify the BODYTITLE option. Because the headers and footers are automatically placed in the body of the document with measured RTF, the TAGSET.RTF destination does not need the BODYTITLE option.

Measured RTF and Graphics

Measured RTF produces output in rich text format, which supports three formats for graphics that MS Word can read.
Format for Graphics
Corresponding SAS Graphics Driver
emfblips
SASEMF
pngblips
PNG
jpegblips
JPEG
When you do not specify a target device, the default target is PNG. You can also use the ACTIVEX, ACTXIMG, JAVAIMG graphics drivers to generate graphics in your measured RTF documents. The ACTIVEX driver generates an ActiveX control. The ACTXIMG and JAVAIMG drivers generate PNG files with the ACTIVEX Control or JAVA Applets appropriately. For more information about graphics devices, see SAS/GRAPH: Reference.
Note: When you specify the JAVA device in the ODS TAGSET.RTF statement, the JAVAIMG driver is used.
Note: You cannot use UTF-8 encoding with the ACTIVEX device in RTF. When UTF-8 encoding is used, the ACTXIMG (activex image) device is used.

Examples

Example 1: Creating a Table of Contents

Features:
ODS TAGSETS.RTF statement::
Action: CLOSE
Option: CONTENTS
Option: TOC_DATA
Other features:

OPTIONS statement

PROC FORMAT

PROC PRINT

PROC SORT

PROC REPORT

PROC TABULATE

Data set: Grain_Production
Format: $CNTRY.
The following example creates a table of contents page that contains embedded table of contents data for some procedures, but not for others. The insertion of the table of contents data can be turned on and off in the middle of a program.

Program

ods html close;
proc sort data=Grain_Production;
   by year country type;
run;
ods tagsets.rtf file='Grain_Tagset.rtf' options(contents='yes' toc_data='yes');
options nobyline;
title 'Leading Grain-Producing Countries';
title2 'for #byval(year)';
proc report data=Grain_Production nowindows;
   by year;
   column country type kilotons;
   define country  / group width=14 format=$cntry.;
   define type     / group 'Type of Grain';
   define kilotons / format=comma12.;
   footnote 'Measurements are in metric tons.';
run;
options byline;
title2;
ods tagsets.rtf options(toc_data='no');
proc tabulate data=Grain_Production format=comma12.;
   class year country type;
   var kilotons;
   table year,
         country*type,
         kilotons*sum=' ' / box=_page_ misstext='No data';
   format country $cntry.;
   footnote 'Measurements are in metric tons.';
run;
ods tagsets.rtf options(toc_data='yes');
proc print data=Grain_Production;
run;
ods tagsets.rtf close;
ods html;

Program Description

Close the HTML destination.The HTML destination is open by default. The ODS HTML statement closes the HTML destination to conserve resources.
ods html close;
Sort the data set Grain_Production.PROC SORT sorts the data, first by values of the variable Year, then by values of the variable Country, and finally by values of the variable Type.
proc sort data=Grain_Production;
   by year country type;
run;
Create RTF output and create a new body file for each page of output.The ODS TAGSETS.RTF statement opens the RTF destination and creates RTF output. The CONTENTS suboption creates a table of contents page. The table of contents page contains a table of contents field that puts all of the contents information that is embedded in the document into a table of contents. This action occurs only if the TOC_DATA suboption is specified along with the CONTENTS suboption. The table of contents information is not embedded by default into the RTF file. You can turn on the insertion of the TOC data by specifying TOC_DATA='YES' or instruct ODS to not insert this information by specifying TOC_DATA ='NO'.
ods tagsets.rtf file='Grain_Tagset.rtf' options(contents='yes' toc_data='yes');
Suppress the default BY line and specify a new value into the BY line.The NOBYLINE option suppresses the default BY line variable. The #BYVAL parameter specification inserts the current value of the BY variable Year into the title.
options nobyline;
title 'Leading Grain-Producing Countries';
title2 'for #byval(year)';
Produce a report.This PROC REPORT step produces a report on grain production. Each BY group produces a page of output. ODS creates a new body file for each BY group. The NOWINDOWS option instructs ODS to run PROC REPORT without the REPORT window and sends its output to the open output destinations.
proc report data=Grain_Production nowindows;
   by year;
   column country type kilotons;
   define country  / group width=14 format=$cntry.;
   define type     / group 'Type of Grain';
   define kilotons / format=comma12.;
   footnote 'Measurements are in metric tons.';
run;
Restore the default BY line and clear the second TITLE statement.The BYLINE option restores the default BY line. The TITLE2 statement clears the second TITLE statement.
options byline;
title2;
Suppress the insertion of table of contents data into the RTF file.The TOC_DATA='NO' option instructs ODS not to insert the table of contents data into the RTF file. Therefore, because the TABULATE procedure follows the TOC_DATA='NO' option, there will be no entry for the TABULATE procedure in the table of contents page.
ods tagsets.rtf options(toc_data='no');
Produce a report.The TABLE statement in the PROC TABULATE step uses three dimensions. Year defines pages, Country and Type define the rows, and Kilotons defines the columns. Therefore, PROC TABULATE explicitly produces one page of output for 1995 and one page for 1996 based on the years specified in the Grain_Production data set. ODS also starts a new body file for each page.
proc tabulate data=Grain_Production format=comma12.;
   class year country type;
   var kilotons;
   table year,
         country*type,
         kilotons*sum=' ' / box=_page_ misstext='No data';
   format country $cntry.;
   footnote 'Measurements are in metric tons.';
run;
Enable the insertion of table of contents data into the RTF file.The TOC_DATA='YES' option instructs ODS to insert the table of contents data into the RTF file. There will be an entry for the PRINT procedure in the table of contents page when the PROC PRINT statement is executed.
ods tagsets.rtf options(toc_data='yes');
Print the Grain_Production data set.
proc print data=Grain_Production;
run;
Close the RTF destination.The ODS TAGSETS.RTF CLOSE statement closes the RTF destination and all the files that are associated with it. If you do not close the destination, then you cannot view the files in a browser window. Open the HTML destination to return ODS to its default setting.
ods tagsets.rtf close;
ods html;

RTF Output

By default the table of contents is collapsed on the table of contents page. To expand the table of contents from Microsoft Word, right-click beneath the title until the Update Field option is shown in the selection list. Then select Update Field.
Collapsed Table of Contents
The table of contents contains entries for PROC REPORT and PROC PRINT only. By default, ODS does not embed the table of contents data in the RTF document until you specify the TOC_DATA='YES' option, which results in an entry for PROC REPORT and all other data. If you turn off the TOC_DATA option before the TABULATE procedure, ODS does not insert information into the RTF document for PROC TABULATE. No other contents information is inserted into the RTF document until you specify TOC_DATA='YES'. In this example, the TOC_DATA='YES' option is specified before the PRINT procedure. Therefore, ODS inserts contents data for PROC PRINT into the table of contents.
Table of Contents for PROC REPORT and PROC PRINT

Example 2: Using the DOC Suboption to Get ODS TAGSETS.RTF Information

Features:
ODS TAGSETS.RTF statement::
Action: CLOSE
Option: OPTIONS (DOC=”HELP”)
Option: FILE=
Other features:

PROC PRINT

The following example prints to the SAS log the OPTIONS suboptions and a description of each available suboption.

Program

ods tagsets.rtf file='Help.rtf' options (doc='help');
proc print data=Sashelp.Class;
run;
ods tagsets.rtf close;

Program Description

Print information about the OPTIONS suboptions to the SAS log file.Specifying the OPTIONS suboption (DOC='HELP') prints Help for the ODS TAGSETS.RTF statement suboptions to the SAS log file. The FILE= option prints the data results to an RTF file named Help.rtf.
ods tagsets.rtf file='Help.rtf' options (doc='help');
Print the data set Sashelp.Class.The PROC PRINT statement prints the Sashelp.Class data set.
proc print data=Sashelp.Class;
run;
Close the TAGSETS.RTF destination. If you do not close this destination, then you cannot view the output.
ods tagsets.rtf close;

Output

Specify the “DOC='HELP' suboption to print all of the OPTIONS suboptions and information about each of the suboptions to the SAS log.
The SAS Log

Example 3: Using the TABLES_OFF Suboption

Features:
ODS TAGSETS.RTF statement::
Action: CLOSE
Option: OPTIONS (TABLES_OFF=”OFF”) (TABLES_OFF=”USERTEXT”) (TABLES_OFF=”STYLES_ELEMENTS”)
Option: FILE=
Option: TEXT=
Other features:

PROC PRINT

The following example turns on and off the tables in RTF output and applies the style element specified by the TABLES_OFF suboption.

Program

ods tagsets.rtf file='tablesOff.rtf' options(TABLES_OFF='STYLE_ELEMENTS');
proc print data=sashelp.class(obs=1) ;
run;
ods tagsets.rtf text='TEXT is placed in a table by default' ;
ods tagsets.rtf options(TABLES_OFF='usertext' );
ods tagsets.rtf text='TEXT is not placed in a table (table is removed when
style element is specified)' ;
ods tagsets.rtf options(TABLES_OFF='off' );
ods tagsets.rtf text='TEXT is placed in a table (returned to default when
tables_off is set to off)' ;
ods tagsets.rtf close;

Program Description

List the style elements that can be applied in the SAS log file.ODS TAGSETS.RTF enables you to apply a style element to the RTF output. To determine the style elements that you can use, list them by specifying the TABLES_OFF suboption. This information is written to the SAS log. Notice that you can use different style elements with each statement.
ods tagsets.rtf file='tablesOff.rtf' options(TABLES_OFF='STYLE_ELEMENTS');
proc print data=sashelp.class(obs=1) ;
run;
ods tagsets.rtf text='TEXT is placed in a table by default' ;
Turn off tables and apply the USERTEXT style element.Specifying TABLES_OFF='USERTEXT' applies the USERTEXT style to the text being written.
ods tagsets.rtf options(TABLES_OFF='usertext' );
ods tagsets.rtf text='TEXT is not placed in a table (table is removed when
style element is specified)' ;
Return to the default, tables are on.Specifying TABLES_OFF ='OFF', returns the option to the default and turns the tables back on.
ods tagsets.rtf options(TABLES_OFF='off' );
ods tagsets.rtf text='TEXT is placed in a table (returned to default when
tables_off is set to off)' ;
Close the RTF destination. If you do not close this destination, then you cannot view the output.
ods tagsets.rtf close;

RTF Output

If you specify the ODS TAGSETS.RTF suboption, TABLES_OFF= style_element lists the style elements that are being used and are written to the SAS log.
RTF Output Using TABLES_OFF=style_elements
The following output illustrates what happens when the TABLES_OFF suboption is used. In this example, ODS places the output text in a table by default. Specifying TABLES_OFF='USERTEXT' turns off the table and applies the USERTEXT style to the output. Lastly, TABLES_OFF='OFF' is specified, which causes the text to be written in a table.
RTF Output Using TABLES_OFF

Example 4: Column Heading Rotation Using the TRHDR, TROWHDRCELL, and TROWD Options

Features:
ODS TAGSETS.RTF statement::
Action: CLOSE
Option: OPTIONS TRHDR= TROWHDRCELL= TROWD=
Other features:

PROC PRINT

OPTIONS statement

The following example creates an RTF file in which the headers and contents of the row and column headings are rotated within the table.

Program

options orientation=landscape nodate nonumber;
  
ods html close;
ods tagsets.rtf file='Mrotate.rtf'
OPTIONS (TRHDR='\trrh750'
         TROWHDRCELL='\cltxbtlr'
         TROWD='\rtlrow');
proc print data=Sashelp.Class(obs=5);
run;
ods tagsets.rtf close;
ods html;

Program Description

Specify the orientation of the page.The ORIENTATION option sets the page to landscape. The NODATE option turns off the output of the date and time. The NONUMBER option tells SAS not to print the page number on the first title line of each page of output.
options orientation=landscape nodate nonumber;
  
Close the HTML destination.The HTML destination is open by default. The ODS HTML statement closes the HTML destination to conserve resources.
ods html close;
Create RTF output using the ODS TAGSETS.RTF statement and rotate the rows and header information in the table.The ODS TAGSETS.RTF statement opens the RTF destination and creates RTF output that will be sent to the Mrotate.rtf file. The three options enable you to manipulate the row and header descriptions. TRHDR enables change to the table row headers. In this example, the RTF string that is specified adds more space to the row headers. TROWHDRCELL enables you to manipulate the table-row cell information. In this case, the information is rotated to vertical. The TROWD option enables you to change the table row description. The RTF string specified changes the first table row to the rightmost row.
ods tagsets.rtf file='Mrotate.rtf'
OPTIONS (TRHDR='\trrh750'
         TROWHDRCELL='\cltxbtlr'
         TROWD='\rtlrow');
Print the Sashelp.Class data set.
proc print data=Sashelp.Class(obs=5);
run;
Close the TAGSETS.RTF destination. If you do not close this destination, then you cannot view the output. Open the HTML destination to return ODS to it’s default setting.
ods tagsets.rtf close;
ods html;

RTF Output

The Mrotate.rtf output shows how ODS has rotated the first row of the table to the rightmost column. ODS added more space to the row headers and made the cell contents of the header row vertical. This table manipulation was caused by using the TRHDR=, TROWHDCELL=, and TROWD= suboptions of OPTIONS.
Mrotate.rtf Output

Example 5: Paneling Using the TABLEROWS and PAGEPANELS Options

Features:
ODS TAGSETS.RTF statement::
Action: CLOSE
Option: TABLEROWS
Option: PAGEPANELS
Other features:

OPTIONS statement

PROC PRINT

DATA statement

The following program provides various examples of how ODS creates panels when a table is wider than a page and presents some different choices for controlling the paneling.

Program

option nodate nonumber;
ods html close;
ods tagsets.rtf file='Panel.rtf';
data temp;
array values val1val50;
do j = 1 to 6;
    do i = 1 to dim(values);
        values(i) = i;
    end;
    output;
end;
run;
ods tagsets.rtf;
title Default Paneling;
proc print data=Temp;
run;
ods tagsets.rtf tablerows=5 pagepanels=4;
title 'Paneling with TABLEROWS=5 and PAGEPANELS=4';
proc print data=Temp;
run;
ods tagsets.rtf close;
ods html;

Program Description

Specify the system options.The NODATE option turns off the output of the date and time. The NONUMBER option tells SAS not to print the page number on the first title line of each page of output.
option nodate nonumber;
Close the HTML destination.The HTML destination is open by default. The ODS HTML statement closes the HTML destination to conserve resources.
ods html close;
Open the RTF and file destination.Open the RTF destination and name the output file Panel.rtf. If you do not specify a filename, the output filename defaults to Sasmeas.rtf.
ods tagsets.rtf file='Panel.rtf';
Produce a large data set.Create a large data set in order to show how paneling works.
data temp;
array values val1val50;
do j = 1 to 6;
    do i = 1 to dim(values);
        values(i) = i;
    end;
    output;
end;
run;
Create RTF output that uses the default paneling.The ODS TAGSETS.RTF statement opens the RTF destination and creates RTF output. Default paneling is used to print the TEMP data set that was created earlier in this program. The title of the table is “Default Paneling”.
ods tagsets.rtf;
title Default Paneling;
proc print data=Temp;
run;
Create RTF output where the number of panels is specified.The ODS TAGSETS.RTF statement opens the RTF destination and creates RTF output. RTF tagset options TABLEROWS and PAGEPANELS enable you to control the number of panels on a page and the number of rows of data that you want output for each table. The title of this multi-paneled table is 'Paneling with TABLEROWS=5 and PAGEPANELS=4';.
ods tagsets.rtf tablerows=5 pagepanels=4;
title 'Paneling with TABLEROWS=5 and PAGEPANELS=4';
proc print data=Temp;
run;
Close the RTF destination. If you do not close this destination, then you cannot view the output. Open the HTML destination to return ODS to its default setting.
ods tagsets.rtf close;
ods html;

RTF Output

Page paneling occurs when a table is wider than a page. By default in measured ODS RTF, panels are grouped together so that all observations are close together. The first column holds as many columns as can fit on one line. The number of rows in each panel is determined by the number that fit on a logical page.
RTF Output with Default Page Paneling
RTF Output with Default Page Paneling
The TABLEROWS option enables you to specify the number of rows for a panel. Note that only five rows are produced for each panel. The other row is presented on a separate page in three different panels.
RTF Output with Options PAGEPANELS and TABLEROWS
RTF Output with Options PAGEPANELS and TABLEROWS
RTF Output with Options PAGEPANELS and TABLEROWS

Example 6: Repeating Headers Using the UNIFORM Option

Features:
ODS TAGSETS.RTF statement::
Action: CLOSE
Option: UNIFORM
Option: FILE=

ODS RTF statement

Other features:

OPTIONS statement

PROC FORMAT

PROC TABULATE

DATA statement

The following example creates a multi-page table that is uniform across several pages. The row and column heading labels are also carried over to each page.

Program

ods html close;
options orientation=landscape;
ods rtf file='RtfTab.rtf';
ods tagsets.rtf file='MrtfTab.rtf' uniform;
data one;
   do a=1 to 2;
      do b=1 to 2;
         do c=1 to 3;
            do d=1 to 3;
               do e=1 to 5;
                  output;
               end;
            end;
         end;
       end;
    end;
run;
proc format;
     value cars 1='DATSUN 200SX'
                2='PONTIAC FIERO';
     value colors 1='RED'
                  2='LIGHT BLUE'
                  3='YELLOW'
                  4='GREEN'
                  5='BROWN';
     value luxury 1='ALL THE WAY'
                  2='STANDARD OPTIONS'
                  3='STRIPPED DOWN';
     value opts 1='POWER STEERING'
                2='SUN ROOF'
                3='AUTOMATIC'
                4='T-TOP'
                5='HATCHBACK'
                6='FUEL-INJECTION'
                7='HUBCAPS'
                8='AM/FM STEREO'
                9='FLOOR MATS'
                10='CASSETTE PLAYER';
     value perform 1='VERY SLOW'
                   2='SLOW'
                   3='AVERAGE'
                   4='FAST'
                   5='VERY FAST';
  run;
data two (keep=model color luxury options perform);
  length model color luxury options perform  $ 20;
     set one;
     model=put(a,cars.);
     color=put(b,colors.);
     luxury=put(c,luxury.);
     options=put(d,opts.);
     perform=put(e,perform.);
  run;
title2 'My Favorite Cars';
  title3 '(large data set)';
proc tabulate data=two order=data ;
     class model color luxury options perform;
     table model*color*luxury*options*perform,n / indent=4 condense;
     label model='MODEL CAR'
           color='COLOR OF CAR'
           luxury='CONDITION OF CAR'
           perform='SPEED';
     keylabel n='NUMBER';
  run;
ods _all_ close;
ods html;

Program Description

Close the HTML destination.The HTML destination is open by default. The ODS HTML statement closes the HTML destination to conserve resources.
ods html close;
Specify the orientation of the page and name the RTF output.Specify landscape as the orientation of the page. Name the RTF output file to RtfTab.rtf.
options orientation=landscape;
ods rtf file='RtfTab.rtf';
Open the RTF file and create output that has UNIFORM header information.The ODS TAGSETS.RTF statement opens the RTF file. The UNIFORM option ensures that the column headings and header information appear on each page.
ods tagsets.rtf file='MrtfTab.rtf' uniform;
Create the data set One.Create a data set that has five columns. Each column consists of one to five subcolumns.
data one;
   do a=1 to 2;
      do b=1 to 2;
         do c=1 to 3;
            do d=1 to 3;
               do e=1 to 5;
                  output;
               end;
            end;
         end;
       end;
    end;
run;
Create user-defined formats.PROC FORMAT creates the formats that SAS will use in the columns and subcolumns of the table.
proc format;
     value cars 1='DATSUN 200SX'
                2='PONTIAC FIERO';
     value colors 1='RED'
                  2='LIGHT BLUE'
                  3='YELLOW'
                  4='GREEN'
                  5='BROWN';
     value luxury 1='ALL THE WAY'
                  2='STANDARD OPTIONS'
                  3='STRIPPED DOWN';
     value opts 1='POWER STEERING'
                2='SUN ROOF'
                3='AUTOMATIC'
                4='T-TOP'
                5='HATCHBACK'
                6='FUEL-INJECTION'
                7='HUBCAPS'
                8='AM/FM STEREO'
                9='FLOOR MATS'
                10='CASSETTE PLAYER';
     value perform 1='VERY SLOW'
                   2='SLOW'
                   3='AVERAGE'
                   4='FAST'
                   5='VERY FAST';
  run;
Create data set Two.Data set Two populates the data set with the formats supplied by PROC FORMAT.
data two (keep=model color luxury options perform);
  length model color luxury options perform  $ 20;
     set one;
     model=put(a,cars.);
     color=put(b,colors.);
     luxury=put(c,luxury.);
     options=put(d,opts.);
     perform=put(e,perform.);
  run;
Create titles for the Output.Provide two titles for the output.
title2 'My Favorite Cars';
  title3 '(large data set)';
Produce a report.PROC TABULATE creates the table of cars and their attributes.
proc tabulate data=two order=data ;
     class model color luxury options perform;
     table model*color*luxury*options*perform,n / indent=4 condense;
     label model='MODEL CAR'
           color='COLOR OF CAR'
           luxury='CONDITION OF CAR'
           perform='SPEED';
     keylabel n='NUMBER';
  run;
Close all destinations.The ODS_ALL_CLOSE statement closes any open destinations and all of the files that are associated with them. If you do not close the destination, you cannot view the files in a browser window.
ods _all_ close;
ods html;

Output

The following output is from the measured RTF output file Mrtftab.rtf. This output is generated using the ODS TAGSETS.RTF statement. Note the differences between the measured output and the traditional RTF output. Note that the cell header information is carried to each page and that the word “Continued” appears at the bottom of each page of RTF output.
Measured RTF Output
Measured RTF Output
Measured RTF Output
The following output is a portion of the Rtftab.rtf file that was generated using the traditional ODS RTF statement. Notice that header information is not carried over to page two of the output. Also note that page one does not indicate that more pages of output follow.
Traditional RTF Output
Traditional RTF Output
Traditional RTF Output