Annotate Dictionary |
Type: | Numeric or character; must match the type of the midpoint variable in the GCHART procedure. |
Length: | Should match the length of the midpoint variable in the GCHART procedure. |
Default: | none |
Restriction: | Used only with vertical or horizontal bar charts produced by the GCHART procedure. |
Syntax | |
Functions | |
Details |
Syntax |
MIDPOINT=midpoint-value; |
references midpoint data value(s) in the GCHART procedure either as a variable name or as an explicit data value. Midpoint-value can have one of the following forms:
midpoint-variable | |
midpoint-data-value | |
'midpoint-data-value' |
Generally, specify a variable name if you want to annotate all of the bars in a horizontal or vertical bar chart. To annotate a bar chart for a specific value of the MIDPOINT variable, specify a specific value.
Functions |
You can use the MIDPOINT variable only with the data coordinate systems 1, 2, 7, and 8, and with these functions:
BAR | PIE | POLY |
DRAW | PIECNTR | POLYCONT |
LABEL | POINT | SYMBOL |
MOVE |
Details |
Using the MIDPOINT variable is similar to using the X and Y variables to position graphics elements in a vertical or horizontal bar chart when using data system coordinates. For example, suppose you produce a vertical bar chart in which the chart variable CITY produces a bar for each city in a data set. The height of each bar is determined by the value of the SUMVAR= variable, UNITS.
You can label these bars by assigning the chart variable CITY to the Annotate MIDPOINT variable. The MIDPOINT variable provides the x coordinate for the label. By default, Annotate assigns the statistic variable, in this case the SUMVAR= variable, UNITS, to the Annotate Y variable, which provides the y coordinate for the label.
Using the MIDPOINT Variable to Position a Label in a Bar Chart shows how the values of the MIDPOINT and Y variables position the label that shows the number of units sold in Atlanta. The value, which is calculated and printed by the LABEL function, is 56.
Using the MIDPOINT Variable to Position a Label in a Bar Chart
The labels in this figure are positioned by the values that are assigned to these Annotate variables:
MIDPOINT=CITY (where CITY is the chart variable); the MIDPOINT variable provides the horizontal coordinate in the vertical bar chart.
Y=UNITS (where UNITS is the SUMVAR= variable); the Y variable provides the vertical coordinate. By specifying Y=units/2, you can vertically center the label in the bar.
Note: In a horizontal bar chart, the MIDPOINT variable controls the y coordinate and the statistic variable controls the x coordinate.
Using the MIDPOINT and X variables in an Annotate data set that is used to annotate a VBAR chart or the MIDPOINT and Y variables in the same data set used to annotate an HBAR chart can cause unexpected results. When annotating a VBAR chart, the Annotate facility uses the MIDPOINT variable as the horizontal coordinate if it exists in the Annotate data set and ignores the X variable. Consequently, you should use the MIDPOINT variable as the horizontal coordinate for all observations in an Annotate data set if you use it for one.
A similar behavior occurs if you use both the MIDPOINT and Y variables in an Annotate data set that is used to annotate HBAR charts. The MIDPOINT variable is always used, regardless of whether it has a missing value, and the Annotate facility ignores the Y variable. In this case, as well, use the MIDPOINT variable for the vertical coordinate for all observations in an Annotate data set if you use it for one.
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.