MIDPOINT Variable
Positions graphics elements on the bars of a vertical or horizontal bar chart drawn by the GCHART procedure.
| 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. |
Table of Contents
Syntax
Variable Values
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
the name of a variable.
midpoint-data-value
a specific numeric data value.
'midpoint-data-value'
a specific character 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.
Details
Using the MIDPOINT Variable
Using the MIDPOINT variable is similar to using the X and Y variables to position in a vertical or horizontal bar chart when using data system . For example, suppose you produce a vertical bar chart in which the 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 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.
CAUTION
Be careful when using MIDPOINT and X and Y variables in the same data set. Using the MIDPOINT and X variables in an Annotate data set that is used to annotate a VBAR chart can cause unexpected results. The same is true when using the MIDPOINT and Y variables in the same data set that is used to annotate an HBAR chart.
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.
Functions
You can use the MIDPOINT variable only with the data 1, 2, 7, and 8, and with these functions:
| BAR | MOVE | POINT |
| DRAW | PIE | SYMBOL |
| LABEL | PIECNTR |