Graphical methodsLinear modelsCategorical dataSEMsUtility macros
Univariate displays
Bivariate displays
Multivariate displays
Cluster analysis
Maps
boxplot
density
dotplot
nqplot
splot
symbox
symplot
contour
ellipses
lowess
miplot
resline
sparkline
sunplot
surface
andrews
biplot
canplot
coplot
corrgram
cqplot
faces
genscat
hecan
hemat
hemreg
heplot
heplots
mpower
outlier
robcov
scatmat
scatter
stars
gtree
ccmap
map2gen
ANOVA
Regression
Multivariate
Transformations
Power
alleff
effplot
hovplot
meanplot
orpoly
poly
twoway
cpplot
effplot
partial
inflplot
robust
rsqdelta
hecan
hemat
hemreg
heplot
heplots
mvinfluence
boxcox
boxglm
boxtid
sprdplot
fpower
mpower
power
rpower
Discrete distributions
Two-way tables
Mosaic displays
Generalized linear models
distplot
goodfit
ordplot
poisplot
rootgram
agree
agreeplot
corresp
ffold
fourfold
power2x2
powerrxc
sieve
sieveplot
missrc
genscat
mosaic
mosaics
mosmat
addvar
catplot
effplot
halfnorm
inflglim
inflogis
logodds
powerlog
robust
caliscmp
calisgfi
csmpower
eqs2ram
ram2dot
str2ram
Data utility
Graphics utility
Macro utility
Color
combine
combos
dummy
expgrid
interact
jitter
lags
map2gen
multisummary
mvnormal
sas2rd
sas2vsta
scale
slice
sort
stat2dat
table
axis
bars
boxanno
boxaxis
equate
gask
gbank
gdispla
genpat
gensym
gkill
gsize
gskip
inset
label
labels
lines
panels
points
polygons
pscale
regline
rug
expglm
defined
lastword
vexpand
words
bpycolors
brewerpal
colochrt
colorramp
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