SGPLOT Procedure

INSET Statement

Adds a text box inside of the axes of the plot.
About Text Insets

Syntax

INSETtext-string-1<... “text-string-n”></ option(s)>;
INSET (label-list) </ option(s)>;

Summary of Optional Arguments

Inset options
specifies whether to display a border around the text box.
specifies how the labels are aligned when you specify label-value pairs.
specifies the position of the text box within the plot.
specifies the appearance of the text in the text box.
specifies how the values are aligned when you specify label-value pairs.
Title options
specifies a title for the text box.
specifies the appearance of the title.

Required Argument

text-string-list | (label-list)
you must specify one of the following arguments:
text-string-list
specifies one or more quoted text strings. Each string is placed on a separate line in the text box (for example, “My line 1” “My line 2”).
(label-list)
specifies a series of quoted labels and values for the text box.
Specify your label-value pairs as follows:
(“label-1” = “value-1” ... “label-n” = “value-n”)
Here is an example: (“My label 1“ = “My value 1” “My label 2” = “My value 2”).
You can format the text in insets and add special characters using the following syntax:
(*ESC*) {sup 'string'}
Specifies that the string appears as a superscript.
(*ESC*) {sub 'string'}
Specifies that the string appears as a subscript.
(*ESC*) {unicode 'hexadecimal-value'x } | keyword }
Specifies a glyph (graphical character) to be displayed using its Unicode hexadecimal value or a SAS keyword equivalent. For more information about SAS keywords, see SAS Keywords for Unicode Glyphs in SAS Graph Template Language: User's Guide.
Note: (*ESC*) is the default ODS escape character. You can set your own escape character with the ODS ESCAPECHAR="character"; statement.
In the following inset statement, the Greek letter alpha denotes the alpha value for the confidence limits in a graph. The R-Square value is displayed using the superscript format:
inset ("(*ESC*){unicode alpha}" = "0.05"
         "R(*ESC*){sup '2'}" = "0.7705") / border;
Here is the text inset for this example:
Inset formatted text

Optional Arguments

BORDER | NOBORDER
specifies whether to display a border around the text box. The BORDER option displays the border. The NOBORDER option hides the border.
LABELALIGN= LEFT | CENTER | RIGHT
specifies how the labels are aligned when you specify label-value pairs. Specify one of the following:
LEFT
aligns the text to the left.
CENTER
aligns the text to the center.
RIGHT
aligns the text to the right.
Default:LEFT
POSITION= position-value
specifies the position of the text box within the plot. The position values are as follows:
BOTTOM
places the text box at the bottom of the graph.
BOTTOMLEFT
places the text box at the bottom left corner of the graph.
BOTTOMRIGHT
places the text box at the bottom right corner of the graph.
LEFT
places the text box at the left side of the graph.
RIGHT
places the text box at the right side of the graph.
TOP
places the text box at the top of the graph.
TOPLEFT
places the text box at the top left corner of the graph.
TOPRIGHT
places the text box at the top right corner of the graph.
If you do not specify a position, then a position is determined automatically.
TEXTATTRS= style-element <(options)> | (options)
specifies the appearance of the text in the text box. You can specify the appearance by using a style element or by using suboptions. If you specify a style element, you can also specify suboptions to override specific appearance attributes.
Here is an example that specifies a style element: TEXTATTRS=GraphDataText
options can be one or more of the following:
COLOR= color
specifies the color of the label characters. You can specify colors using the same color schemes that are supported by SAS/GRAPH software. For more information, see Color-Naming Schemes in SAS/GRAPH: Reference.
Default:For ungrouped data, the default color is specified by the Color attribute of the GraphValueText style element in the current style. For grouped data, the default color is specified by the ContrastColor attribute of the GraphData1 ... GraphDatan style elements in the current style.
FAMILY= “font-family
specifies the font family for the label characters. The SAS ODS styles use TrueType system fonts. For more information, see TrueType Fonts Supplied by SAS in SAS Language Reference: Concepts.
Default:The default font family is specified by the FontFamily attribute of the GraphValueText style element in the current style.
Restriction:You cannot specify a list of font family names.
SIZE= n <units>
specifies the font size of the label characters. You can also specify the unit of measurement. The default unit is pixels. For a list of measurement units that are supported, see Units of Measurement.
Default:The default font size is specified by the FontSize attribute of the GraphValueText style element in the current style.
STYLE= ITALIC | NORMAL
specifies whether the label characters are italic or normal.
Default:The default font style is specified by the FontStyle attribute of the GraphValueText style element in the current style.
WEIGHT= BOLD | NORMAL
specifies whether the label characters are bold or normal.
Default:The default font weight is specified by the FontWeight attribute of the GraphValueText style element in the current style.
Here is an example expression:
TEXTATTRS=(Color=Green Family=Arial Size=8 Style=Italic Weight=Bold)
Default:The default appearance of the text is specified by the GraphValueText style element in the current style.
Tip:The GraphDataText style element makes the text slightly smaller. The GraphLabelText style element makes the text slightly larger.
TITLE= “text-string
specifies a title for the text box. The title text is always center-aligned.
TITLEATTRS= style-element <(options)> | (options)
specifies the appearance of the title. You can specify the appearance by using a style element or by using suboptions. If you specify a style element, you can also specify suboptions to override specific appearance attributes.
Here is an example that specifies a style element: TITLEATTRS=GraphTitleText
options can be one or more of the following:
COLOR= color
specifies the color of the title characters. You can specify colors using the same color schemes that are supported by SAS/GRAPH software. For more information, see Color-Naming Schemes in SAS/GRAPH: Reference.
Default:For ungrouped data, the default color is specified by the Color attribute of the GraphLabelText style element in the current style. For grouped data, the default color is specified by the ContrastColor attribute of the GraphData1 ... GraphDatan style elements in the current style.
FAMILY= “font-family
specifies the font family for the title characters. The SAS ODS styles use TrueType system fonts. For more information, see TrueType Fonts Supplied by SAS in SAS Language Reference: Concepts.
Default:The default font family is specified by the FontFamily attribute of the GraphLabelText style element in the current style.
Restriction:You cannot specify a list of font family names.
SIZE= n <units>
specifies the font size of the title characters. You can also specify the unit of measurement. The default unit is pixels. For a list of measurement units that are supported, see Units of Measurement.
Default:The default font size is specified by the FontSize attribute of the GraphLabelText style element in the current style.
STYLE= ITALIC | NORMAL
specifies whether the title characters are italic or normal.
Default:The default font style is specified by the FontStyle attribute of the GraphLabelText style element in the current style.
WEIGHT= BOLD | NORMAL
specifies whether the title characters are bold or normal.
Default:The default font weight is specified by the FontWeight attribute of the GraphLabelText style element in the current style.
Here is an example expression:
TITLEATTRS=(Color=Green Family=Arial Size=8 Style=Italic Weight=Bold)
Default:The default appearance of the title text is specified by the GraphLabelText style element in the current style.
VALUEALIGN= LEFT | CENTER | RIGHT
specifies how the values are aligned when you specify label-value pairs. Specify one of the following values.
LEFT
aligns the text to the left.
CENTER
aligns the text to the center.
RIGHT
aligns the text to the right.
Default:RIGHT