SAS Macro Programs for Statistical Graphics: DOTPLOT

$Version: 1.2 (30 Sep 2003)
Michael Friendly
York University



DOTPLOT macro ( [download] get dotplot.sas)

DOTPLOT produces grouped and ungrouped dot charts, as described in "Section 2.5".

Parameters

DATA=_LAST_
Name of the input data set
XVAR=
Horizontal (response) variable
XORDER=
Plotting range for response. Specify XORDER in the form XORDER = low TO high BY step.
XREF=
Specifies the horizontal values at which reference lines are drawn for the response variable. If not specified, no reference lines are drawn.
YVAR=
Vertical variable (observation label) for the dot chart. This should specify a character variable. At most 16 characters of the value are used for the label.
YSORTBY=&XVAR
How to sort the observations. The default, YSORTBY=&XVAR, indicates that observations are sorted in ascending order of the response variable.
YLABEL=
Label for y variable. If not specified, the vertical axis is labelled with the name of the YVAR= variable.
GROUP=
Vertical grouping variable. If specified, a grouped dot chart is produced with a separate panel for each value of the GROUP= variable.
GPFMT=
format for printing group variable value (include the "." at the end of the format name).
CONNECT=DOT
Specifies how to draw horizontal lines for each observation. Valid values are ZERO, DOT, AXIS, or NONE. The default, CONNECT=DOT, draws a dotted line from the Y axis to the point. CONNECT=ZERO draws a line from an X value of 0 to the point. CONNECT=AXIS draws a line from the Y axis to the plot frame at the maximum X value. CONNECT=NONE does not draw a line for the observation.
DLINE=2
Line style for horizontal lines for each observation.
DCOLOR=BLACK
Color of horizontal lines
ERRBAR=
Name of an input variable giving length of error bar for each observation. If not specified, no error bars are drawn.
NAME=DOTPLOT
The name assigned to the graph in the graphic catalog.

GOPTIONS required

DOTPLOT plots each observation in a row of the graphics output area. Therefore the VPOS= graphics option should specify a sufficient number of vertical character cells. The value for VPOS= should be
VPOS >= number of observations + number of groups + 8

Example

%include data(auto) ;
*include dotplot ;
 
proc format;
   value $origin  'A'='American'
                  'E'='European'
                  'J'='Japanese';
goptions vpos= 80 hpos=80;
%dotplot(data=auto,
         xvar=mpg,  yvar=model,
         group=origin,gpfmt=$origin.);