Example Program and Statement Details

Example Graph

The following graph was generated by the Example Program:
Example Graph with Entry Text

Example Program

proc template;
  define statgraph entry;
    begingraph;
      layout overlay;

        entry halign=right "First entry statement" /
          valign=top;

        histogram weight;

        entry halign=right "Second entry statement";

        entry halign=right "Third entry statement" /
          valign=bottom pad=(bottom=40px);

      endlayout;
    endgraph;
  end;
run;

proc sgrender data=sashelp.cars template=entry;
run;

Statement Summary

An ENTRY statement creates one line of text in the plot area. The statement must be specified within a LAYOUT, HEADER, SIDEBAR, or CELL statement block. It cannot be specified outside of one of these blocks, where global statements like ENTRYTITLE and ENTRYFOOTNOTE are used.
Entry Text is Displayed in the Graphical Area
The text line specified on an ENTRY statement can be made of several pieces of the text called text-items. Statement options that are used establish properties for the entire line of text (that is, all text-items). These properties can be overridden with prefix-options that are specific to one or more text-items. See Required Arguments for more information.
You can specify an ENTRY statement inside or outside of a nested statement block:
  • When you specify an ENTRY statement inside of a nested LAYOUT, HEADER, SIDEBAR, or CELL statement block, then, by default, the text is placed inside the bounding area of the results that the nested statement block creates.
  • When you specify an ENTRY statement outside of a nested LAYOUT, HEADER, SIDEBAR, or CELL statement block, then the text is placed outside of the bounding area of the results that the nested statement block creates.

Required Arguments

text-item <…<text-item>>
specifies one or more pieces of text for the entry. Each text-item has the following form:
<prefix-option<prefix-option>>"string" | dynamic | character-expression | {text-command}
Each piece of text can have multiple prefix settings that precede the piece of text. A piece of text is either a string literal, a dynamic, or a text command. All text-items with the same HALIGN= setting are concatenated into one string. Up to three strings can result for each ENTRY statement. Leading and trailing blanks in the concatenated string are always used.
When used, a prefix option applies not only to immediately following piece of text but also to ALL subsequent text strings and text-commands. If the same prefix option appears more than once, it has the effect of overriding the last used prefix of the same name.
Requirement:
  • string must be enclosed in quotation marks.
  • character-expression must be enclosed in an EVAL function.
  • text-command must be enclosed in braces.
Restriction: The maximum length for the entry text is 512 characters.
See Managing Text Items for more information and several examples.

Options and Text Commands

prefix-option
Description
Specifies the horizontal alignment of a text-item.
Specifies font attributes for a text-item.
text-command
Description
{SUB}
Specifies that the string or dynamic appears as a subscript.
{SUP}
Specifies that the string or dynamic appears as a superscript.
Specifies a glyph (graphical character) to be displayed using its Unicode specification or keyword equivalent.
Statement Option
Description
Specifies whether the entry is automatically aligned within its parent when nested within an overlay-type or region layout.
Specifies the color of the entry background.
Specifies whether a border is displayed around the entry.
Specifies the properties of the border line.
Specifies whether the entry background is opaque.
Specifies the amount of extra space that is reserved inside the entry border.
Specifies the angle of text rotation.
Specifies the font attributes of the text.
Specifies the vertical alignment of the entry.
AUTOALIGN=NONE | AUTO | (location-list)
specifies whether the entry is automatically aligned within its parent when nested within an overlay-type or region layout. For more information about how child positions are determined in an overlay-type or region layout, see the LAYOUT OVERLAY’s Statement Summary.
Default: NONE
NONE
Do not automatically align the entry within the area. Alignment is set with HALIGN= and VALIGN= options.
AUTO
Available only if the parent layout contains a scatter plot; ignored otherwise. Within the parent layout, attempt to center the entry in the area that is farthest from any surrounding data point markers.
(location-list)
Within the available area, restrict the entry’s possible locations to those locations in the specified location-list, and use the location-list position that least collides with the other graphics features in the area. The location-list is blank-separated and can contain any of these locations: TOPLEFT, TOP, TOPRIGHT, LEFT, CENTER, RIGHT, BOTTOMLEFT, BOTTOM, and BOTTOMRIGHT.
Example: (TOPRIGHT TOPLEFT)
BACKGROUNDCOLOR=style-reference | color
specifies the color of the entry background.
Default: The GraphBackground:Color style reference.
style-reference
A reference of the form style-element:style-attribute. Only the style-attribute named COLOR is used.
Interaction: OPAQUE=TRUE must be in effect for the color to be seen. By default, OPAQUE=FALSE.
BORDER=boolean
specifies whether a border is displayed around the entry.
Default: FALSE
BORDERATTRS=style-element | style-element (line-options) | (line-options)
specifies the attributes of the border line around the text. See General Syntax for Attribute Options for the syntax on using a style-element and Line Options for available line-options.
Default: The GraphBorderLines style element.
Interaction: BORDER=TRUE must be set for this option to have any effect.
HALIGN=CENTER | LEFT | RIGHT
prefix-option that specifies the horizontal alignment of a text-item.
Default: CENTER
Each text-item has a horizontal alignment, and text-items with the same alignment are always grouped together.
OPAQUE=boolean
specifies whether the entry background is opaque (TRUE) or transparent (FALSE).
Default: FALSE
Interaction: When this option is set to FALSE, the background color is not used.
PAD=dimension | (pad-options)
specifies the amount of extra space that is reserved inside the entry border.
Default: (LEFT=3 RIGHT=3 TOP=0 BOTTOM=0)
dimension
Specifies a dimension to use for the extra space at the left, right, top, and bottom of the entry border.
(pad-options)
Enables separate settings for the left, right, top, and bottom padding dimensions. Use the pad-options to create non-uniform padding. These options must be enclosed in parentheses. Each option is specified as a name = value pair. Sides not assigned padding are padded with the default amount.
Values without units are in pixels (px). A unit must be provided if other than pixels.
LEFT=dimension specifies the amount of extra space added to the left side.
RIGHT=dimension specifies the amount of extra space added to the right side.
TOP=dimension specifies the amount of extra space added to the top.
BOTTOM=dimension specifies the amount of extra space added to the bottom.
ROTATE=0 | 90 | 180 | 270
specifies the angle of text rotation measured in degrees. The angle is measured from a horizontal line passing through the middle of the bounding box of the text, counter-clockwise starting at the center of the bounding box.
Default: 0. No rotation is performed.
Restriction: Only angles of 0, 90, 180, or 270 degrees are allowed.
Interaction: The bounding box is the determined by the size of the text in the current font plus any horizontal and vertical padding. See TEXTATTRS= and PAD=.
{ SUB "string" | dynamic }
text-command that specifies that the string or dynamic is to appear as subscript text.
Default: no default
Example: entry "y = " b{sub "0"} " + b" {sub "1"} "x";
{ SUP "string" | dynamic }
text-command that specifies that the string or dynamic is to appear as superscript text.
Default: no default
Example: entry "R" {sup "2"} " = " {format (6.4) RSQUARED} ;
TEXTATTRS=style-element | style-element (text-options) | (text-options)
as a statement option, specifies the text properties of the entire entry text. As a prefix-option, specifies the text properties of individual text-items. See General Syntax for Attribute Options for the syntax on using a style-element and Text Options for available text-options.
Default: The GraphValueText style element.
This option can be used as both a prefix option and a statement option. When used as a prefix option, it overrides the statement option.
When used as a prefix option, TEXTATTRS=( ) cancels the last used TEXTATTRS= prefix option. It resets all text options to those set by 1) the TEXTATTRS= statement option or 2) the default style element for the statement (GraphValueText) if no TEXTATTRS= statement option is used.
{ UNICODE "hex-string"x | keyword | dynamic }
text-command that specifies a glyph (character) to be displayed using its Unicode specification or keyword equivalent.
Default: no default
"hex-string"x
A four-byte hexadecimal constant that represents a UNICODE character in the current font. For a complete listing, see http://unicode.org/charts/charindex.html.
keyword
A SAS keyword for a UNICODE character. For a listing of SAS supplied keywords, see see Reserved Keywords and Unicode Values..
dynamic
The dynamic must resolve to either "hex-string"x or a keyword for a UNICODE character.
Examples: The following statements show how to use the {UNICODE} text command:
entry {unicode alpha} "=" CONF;

entry {unicode "03B1"x} "=" CONF;
This text command attempts to access a UNICODE value in the current font. Not all fonts support accessing characters via their UNICODE value. Some fonts only support a limited set of UNICODE values. If the UNICODE value is not accessible, the command might be ignored or an unprintable character might be substituted.
VALIGN=CENTER | TOP | BOTTOM
specifies the vertical alignment of the entry.
Default: CENTER