SGPLOT Procedure

VECTOR Statement

Creates a vector plot that draws arrows from a point of origin to each data point.
About Vector Plots

Syntax

VECTOR X= numeric-variable Y= numeric-variable </ option(s)>;

Summary of Optional Arguments

Group options
specifies a variable that is used to group the data.
Label options
displays a label for each data point.
specifies the appearance of the labels in the plot when you use the DATALABEL= option.
Plot options
specifies the value of the ID variable in an attribute map data set.
specifies a label that identifies the vector plot in the legend.
specifies a name for the plot.
specifies the degree of transparency for the lines.
assigns the X variable to the secondary (top) horizontal axis.
assigns the Y variable to the secondary (right) vertical axis.
Vector options
specifies the location of the arrowheads for the vectors.
specifies the shape of the arrowheads for the vectors.
specifies the appearance of the vector line.
removes the arrowheads from the vectors.
specifies that missing values of the group variable are not included in the plot.
specifies the X coordinate of the origin for the vectors.
specifies the Y coordinate of the origin for the vectors.

Required Arguments

X= numeric-variable
specifies a numeric variable for the x axis.
Y= numeric-variable
specifies numeric variable for the y axis.

Optional Arguments

ARROWDIRECTION= IN | OUT | BOTH
specifies the location of the arrowheads for the vectors. Specify one of the following:
IN
places the arrowheads at the origin of the vector.
OUT
places the arrowheads at the ending point of the vector.
BOTH
places arrowheads at both the origin and the ending point of the vector.
Default:OUT
ARROWHEADSHAPE= shape
specifies the shape of the arrowheads for the vectors. Specify one of the following:
OPEN
resembles the letter "V".Open arrowhead
CLOSED
an outline of a triangle.closed arrowhead
FILLED
a solid triangle.filled arrowhead
BARBED
a solid triangle with an indent at the base. barbed arrowhead
Default:OPEN
ATTRID= variable
specifies the value of the ID variable in an attribute map data set. You specify this option only if you are using an attribute map to control visual attributes of the graph. For more information, see Using SG Attribute Maps to Control Visual Attributes.
DATALABEL <= variable>
displays a label for each data point. If you specify a variable, the values of that variable are used for the data labels. If you do not specify a variable, then the values of the Y variable are used for the data labels.
DATALABELATTRS= style-element <(options)> | (options)
specifies the appearance of the labels in the plot when you use the DATALABEL= option. 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: DATALABELATTRS=GraphLabelText
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 GraphDataText 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 GraphDataText style element in the current style.
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 GraphDataText style element in the current style.
STYLE= ITALIC | NORMAL
specifies whether the label characters are italic (ITALIC) or normal (NORMAL).
Default:The default font style is specified by the FontStyle attribute of the GraphDataText style element in the current style.
WEIGHT= BOLD | NORMAL
specifies whether the label characters are bold (BOLD) or normal (NORMAL).
Default:The default font weight is specified by the FontWeight attribute of the GraphDataText style element in the current style.
Here is an example expression:
DATALABELATTRS=(Color=Green Family=Arial Size=8 Style=Italic Weight=Bold)
Default:The default style element is GraphDataText.
Interaction:This option has no effect unless the DATALABEL option is also specified.
GROUP= variable
specifies a variable that is used to group the data. The plot elements for each group value are automatically distinguished by different visual attributes.
LEGENDLABEL= “text-string
specifies a label that identifies the vector plot in the legend. By default, the label of the Y variable or the group value for each plot element is used.
Interaction:The LEGENDLABEL= option has no effect if you also specify the GROUP= option in the same plot statement.
LINEATTRS= style-element <(options)> | (options)
specifies the appearance of the vector line. 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.
options can be one or more of the following:
COLOR= color
specifies the color of the line. 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 ContrastColor attribute of the GraphDataDefault 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.
PATTERN= line-pattern
specifies the line pattern for the line. You can reference SAS patterns by number or by name. For a list of line patterns, see Line Patterns.
Default:For ungrouped data, the default line pattern is specified by the LineStyle attribute of the GraphDataDefault style element in the current style. For grouped data, the default line pattern is specified by the LineStyle attribute of the GraphData1 ... GraphDatan style elements in the current style.
THICKNESS= n <units>
specifies the thickness of the line. You can also specify the unit of measure. The default unit is pixels. For a list of measurement units that are supported, see Units of Measurement.
Default:For ungrouped data, the default line thickness is specified by the LineThickness attribute of the GraphDataDefault style element in the current style. For grouped data, the default line thickness is specified by the LineThickness attribute of the GraphData1 ... GraphDatan style elements in the current style.
NAME= “text-string
specifies a name for the plot. You can use the name to refer to this plot in other statements.
Note:The name is case-sensitive. When you refer to the specified name in other statements, you must use the same exact capitalization.
NOARROWHEADS
removes the arrowheads from the vectors.
NOMISSINGGROUP
specifies that missing values of the group variable are not included in the plot.
TRANSPARENCY= numeric-value
specifies the degree of transparency for the lines. Specify a value from 0.0 (completely opaque) to 1.0 (completely transparent).
Default:0.0
X2AXIS
assigns the X variable to the secondary (top) horizontal axis.
XORIGIN= numeric-value | numeric-variable
specifies the X coordinate of the origin for the vectors. You can specify either a numeric value or a numeric variable.
Default:0
Y2AXIS
assigns the Y variable to the secondary (right) vertical axis.
YORIGIN= numeric-value | numeric-variable
specifies the Y coordinate of the origin for the vectors. You can specify either a numeric value or a numeric variable.
Default:0