• Print  |
  • Feedback  |

FOCUS AREAS

Return to ODS

Base SAS

In-Line Formatting for ODS in SAS 8.2

In SAS 8.2 and later, ODS supports the ability to insert simple formatting text into the output; that is, within a cell or paragraph. This is experimental beginning in SAS 8.2 and will be production for all destinations in SAS 9.2. Use the syntax

ODS ESCAPECHAR='escape-character';

to specify an escape character. Do not choose an escape character that occurs for any other reason in your code or output. For instance, if you use the escape character to insert an image and you include the image's pathname, and you're running under Windows, then '\' would be a spectacularly poor choice for the escape character.

If you do not specify an escape character, then the character '03'x is used. This character is safe -- it can't be used in normal text so it won't accidentally trigger processing. However, it is very inconvenient to use, so the following examples assume that we've set the escapechar to \ with the following code:

   ods escapechar='\';

See also "inline formatting" in the ODS PRINTER section of SAS Notes and Concepts for ODS.

Here are the ways you can use the escape character:

\S={style-attributes}
Modifies the style of the current paragraph or cell. The syntax is just like that of the style={} syntax in table templates and PROCs REPORT and TABULATE except that no style element is supported to the left of the {}s.
\S={}
A specialized case of the above; reverts the style to the style of the paragraph.
\{function arguments}
An open-ended mechanism for providing functions to allow a portable way to get specialized formatting effects to work across destinations. Initial plans definitely include:
{super text}
put text into a superscript
{sub text}
put text into a subscript
{dagger}
the "dagger" character
Basically this is the leading edge of what I hope will eventually become a more open-ended and user-configurable mechanism for formatting functions.
\R"raw-text"
Inserts raw-text into the destination. The document is laid out (for PRINTER purposes anyway) as if the raw text occupies no space on the page.
\R/type"raw-text"
Inserts the raw text only if the destination is of type type. For example, \R/HTML"<html>"\R/RTF"{rtf}". The types that are supported (this list is not complete) include
RTF
ODS RTF destination.
PS
ODS PS destination, or ODS PRINTER with the PS option.
PCL
ODS PCL destination, or ODS PRINTER with the PS option.
PRINTER
ODS PRINTER with neither the PS nor PDF options. Raw text is rather dangerous in this context, as it could be hooked up to any printer with any specification language, but if you know your destination, it gives you unlimited power.
\m
Marks a location for wrap-around. This gets you the same effect as on an error message, where we come back around to this position on the next line. Unfortunately, it only works for PRINTER.
\n, \-2n
Inserts a new line. The second form wraps around to the position of the mark if supported.
\w
Marks a good place for an optional line-break. Doesn't force a new line, but "suggests" it as a good place if the line must be wrapped.
\_
Inserts a non-breaking space.
\1z, \2z, \3z, \4z
Error, Warning, Note, and Fatal tags, respectively. Lets the user format error messages in the same way that SAS procedures do.