Example Program and Statement Details

Example Graph

The following graph was generated by the Example Program:
Example Vector Plot

Example Program

data CarPref;
  input Make $12. Model $13. (S1-S25) (1.);
datalines;
Cadillac   Deville      8007990491240508971093809
Chevrolet  Aveo         0051200423451043003515698
Chevrolet  Cavalier     4053305814161643544747795
Chevrolet  Malibu       6027400723121345545668658
Dodge      Intrepid     7006000434101107333458708
Dodge      Stratus      3005005635461302444675655
Dodge      Neon         4005003614021602754476555
Ford       Taurus       2024006715021443530648655
Ford       Mustang      5007197705021101850657555
Ford       Focus        0021000303030201500514078
Honda      Accord       5956897609699952998975078
Honda      Civic        4836709507488852567765075
Lincoln    LS           7008990592230409962091909
Pontiac    Firebird     0107895613201206958265907
Volkswagen Jetta        4858696508877795377895000
Volkswagen Beetle       4858509709695795487885000
Volvo      S40          9989998909999987989919000
;
run;
* Compute Two Component Model;
ods graphics;
ods exclude all;
ods output mdprefplot=plotdata;
proc prinqual data=CarPref n=2 replace mdpref method=mgv;
  id model;
  transform monotone(S1-S25);
run;
ods select all;

proc template;
 define statgraph vectorplot;
  begingraph;
   entrytitle "Multidimensional Preference Analysis";
   entrytitle "of Preference Ratings for Automobiles";
   layout overlayequated / equatetype=fit cycleattrs=true;
    referenceline y=0 / datatransparency=.7;
    referenceline x=0 / datatransparency=.7;
    vectorplot y=vec2 x=vec1 xorigin=0 yorigin=0 /
      datalabel=label2var;
    scatterplot y=prin2 x=prin1 /
      datalabel=idlab1 primary=true
      markerattrs=(symbol=circlefilled);
   endlayout;
  endgraph;
 end;
run;

proc sgrender data=plotdata template=vectorplot;
run;

Statement Summary

By default in a VECTORPLOT, each vector starts at 0, 0 in the data space. To specify alternative coordinates for the starting point, use the XORIGIN= and YORIGIN= arguments.

Required Arguments

X=numeric-column | expression
specifies the column for the X values of the vector endpoints.
Y=numeric-column | expression
specifies the column for the Y values of the vector endpoints.
XORIGIN=numeric-constant | numeric-column | expression
Specifies the X data coordinate of the vector origin.
YORIGIN=numeric-constant | numeric-column | expression
Specifies the Y data coordinate of the vector origin.

Options

Statement Option
Description
Specifies the direction of the arrowhead at the end of a vector.
Specifies whether arrowheads are displayed on the vectors.
Specifies the shape of the arrowheads.
Specifies whether the origin is considered when determining the data ranges for the axes.
Specifies the labels at the ends of the vectors.
Specifies the color and font attributes of the data labels.
Specifies the location of the data labels relative to the end points and arrow heads
Specifies the degree of the transparency of the vector line and arrow.
Creates a separate vector plot for each unique group value of the specified column.
Specifies whether missing values of the group variable are included in the plot.
Specifies indices for mapping line attributes (color and pattern) to one of the GraphData1–GraphDataN style elements.
Specifies a label for a legend.
Specifies the properties of the series line.
Assigns a name to a plot statement for reference in other template statements.
Specifies that the data columns for this plot and the plot type be used for determining default axis features.
Specifies user-defined roles that can be used to display information in the tooltips.
Specifies the scale factor of the vector length.
Specifies the information to display when the cursor is positioned over a vector line.
Specifies display formats for information defined by roles.
Specifies display labels for information defined by roles.
Specifies whether data are mapped to the primary X (bottom) axis or the secondary X2 (top) axis.
Specifies whether data are mapped to the primary Y (left) axis or the secondary Y2 (right) axis.
ARROWDIRECTION=OUT | IN |BOTH
specifies the placement of the arrowhead(s) at the end of the vector.
Default: OUT
OUT
specifies a single arrowhead, pointing away from the origin, at the end of the vector away from the origin.
IN
specifies a single arrowhead, pointing toward the origin, at the end of the vector near the origin.
BOTH
specifies two arrowheads. One arrowhead points away from the origin, at the end of the vector opposite from the origin. The other arrowhead points toward the origin, at the end of the vector near the origin.
Interaction: If ARROWHEADS=FALSE, this option is ignored.
Use the ARROWHEADSHAPE= option to control arrowhead appearance.
ARROWHEADS=boolean
specifies whether arrowheads are displayed on the vectors.
Default: TRUE
Interaction: When this option is set to FALSE, the ARROWDIRECTION= and ARROWHEADSHAPE= options are ignored and all vectors are displayed as undirected line segments.
ARROWHEADSHAPE=OPEN | CLOSED | FILLED | BARBED
specifies the shape of the arrowheads.
arrow head shapes
Default: OPEN
Interaction: This option is ignored if ARROWHEADS=FALSE.
Use the ARROWDIRECTION= option to control arrow direction.
CLIP=boolean
specifies whether the origin is considered when determining the data ranges for the axes.
Default: FALSE.
FALSE
The origin contributes to data range for each axis. Each axis might be extended to force the display of the origin.
TRUE
The origin is ignored when establishing axis scales. Each axis scale is determined by the other plots in the overlay. This might result in the origin not being displayed if its data range is not within the data ranges of tips of the vectors.
DATALABEL=column | expression
specifies the labels at the ends of the vectors.
Default: no data labels are displayed
The label positions are automatically adjusted to prevent the labels from colliding with other labels and other arrows.
DATALABELATTRS=style-element | style-element (text-options) | (text-options)
specifies the color and font attributes of the data labels. See General Syntax for Attribute Options for the syntax on using a style-element and Text Options for available text-options.
Default:
  • For non-grouped data, the GraphDataText style element.
  • For grouped data, the GraphData1:ContrastColor-GraphDataN:ContrastColor style references.
Interaction: For this option to take effect, the DATALABEL= option must also be specified.
DATALABELPOSITION = AUTO | TOPRIGHT | TOP | TOPLEFT | LEFT | CENTER | RIGHT | BOTTOMLEFT | BOTTOM | BOTTOMRIGHT
specifies the location of the data labels relative to the end points and arrow heads.
Default: AUTO
DATATRANSPARENCY=number
specifies the degree of the transparency of the vector line and arrow.
Default: 0
Range: 0 (opaque) to 1 (entirely transparent)
GROUP=column | discrete-attr-var | expression
creates a distinct set of vector lines and data label colors for each unique group value of the specified column.
discrete-attr-var
specifies a discrete attribute variable that is defined in a DISCRETEATTRVAR statement.
Restriction: A discrete attribute variable specification must be a direct reference to the attribute variable. It cannot be set by a dynamic variable.
Default: Each distinct group value might be represented in the graph by a different combination of color and line pattern. Lines vary according to the ContrastColor and LineStyle attributes of the GraphData1–GraphDataN style elements.
Interaction: The group values are mapped in the order of the data, unless the INDEX= option is used to alter the default sequence of line patterns and colors.
Interaction: The INCLUDEMISSINGGROUP= option controls whether missing group values are considered a distinct group value.
Tip: The LINEATTRS= option can be used to override the representations that are used to identify the groups. For example, LINEATTRS=(PATTERN=SOLID) can be used to assign the same pattern to all of the lines, letting the line color distinguish group values. Likewise, LINEATTRS=(COLOR=BLACK) can be used to assign the same color to all of the lines, letting the line pattern distinguish group values.
INCLUDEMISSINGGROUP=boolean
specifies whether missing values of the group variable are included in the plot.
Default: TRUE
Interaction: For this option to take effect, the GROUP= option must also be specified.
Tip: Unless a discrete attribute map is in effect or the INDEX= option is used, the attributes of the missing group value are determined by the GraphMissing style element except when the MISSING= system option is used to specify a non-default missing character or when a user-defined format is applied to the missing group value. In those cases, the attributes of the missing group value are determined by a GraphData1–GraphDataN style element.
INDEX=numeric-column | expression
specifies indices for mapping line attributes (color and pattern) to one of the GraphData1–GraphDataN style elements.
Default: no default
Restriction: If the value of the numeric-column is missing or is less than 1, the observation is not used in the analysis. If the value is not an integer, only the integer portion is used.
Interaction: For this option to take effect, the GROUP= option must also be specified.
Interaction: All of the indexes for a specific group value must be the same. Otherwise, the results are unpredictable.
Interaction: If this option is not used, then the group values are mapped in the order of the data.
Interaction: The index values are 1-based indices. For the style elements GraphData1–GraphDataN, if the index value is greater than N, then a modulo operation remaps that index value to a number less than N to determine which style element to use.
Discussion: Indexing can be used to collapse the number of groups that are represented in a graph. For more information, see Remapping Groups for Grouped Data.
LEGENDLABEL= "string"
specifies a label for the legend item that is associated with this plot.
Default: The string specified on the NAME= option.
Restriction: This option applies only to an associated DISCRETELEGEND statement.
Interaction: If the GROUP= option is specified, this option is ignored.
LINEATTRS=style-element | style-element (line-options) | (line-options)
specifies the attributes of the vector line and arrowhead. See General Syntax for Attribute Options for the syntax on using a style-element and Line Options for available line-options.
Default:
  • For non-grouped data, the GraphDataDefault style element.
  • For grouped data, the ContrastColor, LineStyle, and LineThickness attributes of the GraphData1–GraphDataN style elements.
NAME="string"
assigns a name to a plot statement for reference in other template statements.
Default: no default
Restriction: The string is case sensitive, cannot contain spaces, and must define a unique name within the template.
Interaction: The string is used as the default legend label if the LEGENDLABEL= option is not used.
The specified name is used primarily in legend statements to coordinate the use of colors and line patterns between the graph and the legend.
PRIMARY=boolean
specifies that the data columns for this plot and the plot type be used for determining default axis features.
Default: FALSE
Restriction: This option is ignored if the plot is placed under a GRIDDED or LATTICE layout block.
Details: This option is needed only when two or more plots within an overlay-type layout contribute to a common axis. For more information, see When Plots Share Data and a Common Axis.
ROLENAME=(role-name-list)
specifies user-defined roles that can be used to display information in the tooltips.
Default: no user-defined roles
(role-name-list)
a blank-separated list of rolename = column pairs.
For example, ROLENAME= (TIP1=OBS) assigns the column OBS to the user-defined role TIP1.
Requirement: The role names that you choose must be unique and different from the pre-defined roles X, Y, DATALABEL, XORIGIN, YORIGIN, GROUP, and INDEX.
Interaction: For this option to take effect, the TIP= option must also be used.
This option provides a way to add to the data columns that appear in tooltips specified by the TIP= option.
SCALE=number
specifies the scale factor of the vector length.
Default: 1.0
Restriction: The number specified must be greater than 0.
TIP=(role-list)
specifies the information to display when the cursor is positioned over a vector line. If this option is used, it replaces all the information displayed by default. Roles for columns that do not contribute to the vector plot can be specified along with roles that do.
Default: The columns assigned to these roles are automatically included in the tooltip information: X, Y, DATALABEL, XORIGIN, YORIGIN, and GROUP.
(role-list)
an ordered, blank-separated list of unique VECTORPLOT and user-defined roles. VECTORPLOT roles include X, Y, DATALABEL, XORIGIN, YORIGIN, GROUP, and INDEX.
User-defined roles are defined with the ROLENAME= option.
The following example displays tooltips for the columns assigned to the roles X, Y, GROUP, and the column OBS, which is not assigned to any pre-defined VectorPlot role. The OBS column must first be assigned a role.
  ROLENAME=(TIP1=OBS)
  TIP= (TIP1 X Y GROUP)
Requirement: To generate tooltips, you must include an ODS GRAPHICS ON statement that has the IMAGEMAP option specified, and write the graphs to the ODS HTML destination.
Interaction: The labels and formats for the TIP variables can be controlled with the TIPLABEL= and TIPFORMAT= options.
TIPFORMAT=(role-format-list)
specifies display formats for tip columns.
Default: The column format of the variable assigned to the role.
(role-format-list)
a list of rolename = format pairs separated by blanks.
  ROLENAME=(TIP1=OBS)
  TIP=(TIP1 X Y GROUP)
  TIPFORMAT=(TIP1=3.) 
Requirement: Columns must be assigned to the roles for this option to have any effect. See the ROLENAME= option.
This option provides a way to control the formats of columns that appear in tooltips. Only the roles that appear in the TIP= option are used.
TIPLABEL=(role-format-list)
specifies display labels for tip columns.
Default: The column label or column name of the variable assigned to the role.
(role-label-list)
a list of rolename = "string" pairs separated by blanks.
   ROLENAME=(TIP1=OBS) 
   TIP=(TIP1 X Y GROUP)
   TIPLABEL=(TIP1="Observation #")
Requirement: Columns must be assigned to the roles for this option to have any effect. See the ROLENAME= option.
This option provides a way to control the labels of columns that appear in tooltips. Only the roles that appear in the TIP= option are used.
XAXIS=X | X2
specifies whether data are mapped to the primary X (bottom) axis or to the secondary X2 (top) axis.
Default: X
Interaction: The overall plot specification and the layout type determine the axis display. For more information, see How Axis Features Are Determined.
YAXIS=Y | Y2
specifies whether data are mapped to the primary Y (left) axis or to the secondary Y2 (right) axis.
Default: Y
Interaction: The overall plot specification and the layout type determine the axis display. For more information, see How Axis Features Are Determined.