bars Create an annotate data set to draw error bars bars

Visualizing Categorical Data: bars

$Version: 1.2 (27 Feb 2002)
Michael Friendly
York University

The bars macro ( [download] get bars.sas)

Create an annotate data set to draw error bars

The BARS macro creates an Annotate data set to draw error bars in a plot. The error bars may be drawn for a response variable displayed on the Y axis or on the X axis. The other (CLASS=) variable may be character or numeric.

Usage

The BARS macro is called with keyword parameters. The VAR= and CLASS= variables must be specified. The length of the error bars should be specified with either the BARLEN= parameter or the LOWER= and UPPER= parameters.

The arguments may be listed within parentheses in any order, separated by commas. For example:

  %bars(class=age, var=logodds, lower=lower, upper=upper);
  proc gplot data=mydata;
     plot logodds * age / anno=_bars_;

Parameters

DATA=
Name of input data set [Default: DATA=_LAST_]
VAR=
Name of the response variable, to be plotted on the axis given by the BAXIS= parameter.
CLASS=
Name of the independent variable, plotted on the other axis.
CVAR=
Name of a curve variable, when PROC GPLOT is used with the statement PLOT &VAR * &CLASS = &CVAR.
BY=
Name of a BY variable for multiple plots, when PROC GPLOT is used with the statement BY &BY;.
BAXIS=
One of X or Y, indicating the axis along which error bars are drawn [Default: BAXIS=Y]
BARLEN=
A numeric variable or constant giving the error bar length, for example, when the input data set contains a standard error variable or multiple thereof. If BARLEN= is given, the LOWER= and UPPER= values are ignored, and error bars are drawn at the values &VAR +- &Z * &BARLEN.
Z=
A numeric value giving the multiplier of the BARLEN= value used to determine the lower and upper error bar values.
LOWER=
A numeric variable or constant giving the lower error bar value. Use the LOWER= and UPPER= parameters if the error bars are non-symmetric or if the lower and upper values are contained as separate variables in the input data set.
UPPER=
A numeric variable or constant giving the upper error bar value.
TYPE=
Type of error bars to be drawn: one of UPPER, LOWER, or BOTH and possibly one of ALT or ALTBY. [Default: TYPE=BOTH]
TYPE=LOWER draws only the lower error bars;
TYPE=UPPER draws only the upper error bars;
TYPE=BOTH draws both upper and lower error bars.
Use TYPE=ALT BOTH to have the error bars alternate (lower, upper) over observations in the input data set;
use TYPE=ALTBY BOTH to have the error bars alternate over values of the BY= variable.
SYMBOL=
The plotting symbol, drawn at (&CLASS, &var). If not specified, no symbols are drawn.
COLOR=
Color for lines and symbols, a character constant (enclosed in quotes), or variable name [Default: COLOR='BLACK']
LINE=
The Annotate line style used for error bars [Default: LINE=1]
SIZE=
Size of symbols and thickness of lines [Default: SIZE=1]
BARWIDTH=
The width of error bar tops, in data units [Default: BARWIDTH=.5]
OUT=
Name of the output data set, to be used as an Annotate data set with PROC GPLOT [Default: OUT=_BARS_]

See also

label Create an Annotate dataset to label observations
points Create an Annotate dataset to draw points in a plot
pscale Construct annotations for a probability scale