Using Text Commands

Available Text Commands

Text commands on ENTRY, ENTRYTITLE, and ENTRYFOOTNOTE statements are special in-line instructions that either modify the appearance of the text or script special characters. The following text commands are available:
{SUB}
Specifies that the string or dynamic appears as a subscript.
{SUP}
Specifies that the string or dynamic appears as a superscript.
{UNICODE}
Specifies a glyph (graphical character) to be displayed using its Unicode specification or keyword equivalent.
The general form of a text command is
{command argument(s)}
The opening and closing braces are required to denote the scope of the command.

Subscripting and Superscripting Text

The {SUB} and {SUP} text commands are used to subscript and superscript text. Each of these text commands accepts a string or a dynamic for its argument(s).
In the following example, if _RSQUARE is an existing dynamic that resolves to the value .7434, then the following ENTRY specification superscripts the string value "2" to generate this text:
Formula that Results from the Example ENTRY Statement
entry textattrs=(weight=bold) "R" {sup "2"}
      textattrs=() "=" _RSQUARE;
Notice that textattrs=() cancels all style overrides and reverts to the default text properties.

Using UNICODE Text

The {UNICODE} text command places special characters into the text and accepts any of the following for its argument(s):
  • a hexadecimal Unicode Code Point for a character (for example, "03B1"x)
  • a reserved keyword for a commonly used code point (for example, beta)
  • a dynamic that resolves to a hexadecimal value or keyword.
See the tables in Reserved Keywords and Unicode Values for a list of the reserved keywords and Unicode values (the tables are not complete, but give a good idea about what is possible).
Multiple arguments can be used within the scope of a single UNICODE text command. For example, the following two specifications are equivalent:
{unicode "03b1"x beta}
{unicode "03b1"x} {unicode beta}
The default formatting for the UNICODE text is derived from the GraphUnicodeText style element.
In the following example, if _ALPHAVAL is an existing dynamic that resolves to the value 0.05, then the following ENTRY specification generates this text:
Unicode Expression that Results from the Example ENTRY Statement
entry {unicode alpha} " = " _ALPHAVAL;
By combining the TEXTATTRS= prefix option with the {SUB} and {UNICODE} text commands, you can generate the following text:
Formula that Results from the Example ENTRY Statement
Entry textattrs=(style=italic) "E(Y)" textattrs=() " = "
      {unicode beta} {sub "0"} " + "
      {unicode beta} {sub "1"} "x" {sub "1"}
      " + " {unicode beta} {sub "2"} "x" {sub "2"};

Rules for Unicode and Special Character Specifications

The following rules apply to Unicode and special character specifications in ODS graphics:
  • Each character can be specified by looking up its code and specifying it as a hexadecimal constant. Example: {unicode ’221e’x}.
  • Lower case Greek letters can be specified by using names instead of hexadecimal constants. Example: {unicode alpha}.
  • Upper case Greek letters can be specified by using names followed by _u instead of a hexadecimal constants. Example: {unicode alpha_u}.
  • Superscript and subscript have special abbreviations. Examples: {sup 2} and {sub 2}.
  • The {SUP} and {SUB} specifications must not appear escaped and in quotes in the GTL. They must appear outside of quotes.
  • Some characters overprint the character that comes before. Example: ’El nin’ {tilde} ’o’, which is equivalent to ’El nin’ {unicode ’0303’x} ’o’ creates ‘El niño’.
  • Specifications inside quotes are escaped. Example: "(*ESC*){unicode beta}".
  • Specifications outside quotes are not escaped. Example: {unicode beta}.
For more information about using text throughout the GTL (for example, using Unicode values in labels), see SAS Graph Template Language: User's Guide.