Creating RTF Output with ODS

The ODS RTF Statement

To open, manage, or close the RTF destinations that produces output that is written in Rich Text Format for use with Microsoft Word, use the ODS RTF statement:
Syntax, ODS RTF statement:
ODS RTF <(<ID=>identifier)> <action>;
  • (<ID=>identifier) enables you to open multiple instances of the same destination at the same time. Each instance can have different options.
    • identifier can be numeric or can be a series of characters that begin with a letter or an underscore. Subsequent characters can include letters, underscores, and numerals.
  • action can be one of the following:
    • CLOSE action closes the destination and any files that are associated with it.
    • EXCLUDE exclusions| ALL | NONE action excludes one or more output objects from the destination.
      Note: The default is NONE. A destination must be open for this action to take effect.
    • SELECT selections| ALL | NONE action selects output objects for the specified destination.
      Note: The default is ALL. A destination must be open for this action to take effect.
    • SHOW action writes the current selection list or exclusion list for the destination to the SAS log.
      Note: If the selection or exclusion list is the default list (SELECT ALL), then SHOW also writes the entire selection or exclusion list. The destination must be open for this action to take effect.

Opening and Closing the RTF Destination

You can modify an open RTF destination with many ODS RTF options. However, the FILE= option performs the following actions on an open RTF destination:
  • close the open destination referred to in the ODS RTF statement
  • close any files associated with the open RTF destination
  • open a new instance of the RTF destination
Tip
If you use the FILE= option, you should explicitly close the destination yourself.

Understanding How RTF Formats Output

RTF produces output for Microsoft Word. Although other applications can read RTF files, the RTF output might not work successfully with the other applications.
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 when you edit your text. Your tables remain intact on one page, or they break where you specify.
However, Microsoft Word requires the widths of table columns, and Microsoft Word cannot adjust tables if they are too wide for the page. Therefore, ODS measures the width of the text and tables (horizontal measurement). All of 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 are displayed consistently even after you modify your RTF file.
Note: Complex tables that contain a large number of observations can reduce system efficiencies and take longer to process.

ODS RTF and Graphics

ODS RTF produces output in rich text format, which supports three formats for graphics that Microsoft Word can read.
Format for Graphics
Corresponding SAS Graphics Driver
emfblips
EMF
pngblips
PNG
jpegblips
JPEG
When you do not specify a target device, the default target is EMF.

Example: Using the STYLE= Option (FestivalPrinter Style)

In the following program, the STYLE= option applies the FestivalPrinter style to the output for the ODS RTF statement:
ods html close;
ods rtf file="SampleRTF" style=FestivalPrinter; 
proc freq data=sashelp.cars;
  tables origin*type;
run;
ods rtf close;
Figure 16.10 ODS RTF Output with the FestivalPrinter Style Applied
ODS RTF Output with FestivalPrinter Style Applied
Last updated: August 23, 2018
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.144.56