dotplot dotplot - Macro for dot charts dotplot

SAS Macro Programs: dotplot

$Version: 1.5-3 (11 Dec 2008)
Michael Friendly
York University

DOTPLOT macro ( [download] get

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


Name of the input data set
Horizontal (response) variable
Plotting range for response. Specify XORDER in the form XORDER = low TO high BY step.
Specifies the horizontal values at which reference lines are drawn for the response variable. If not specified, no reference lines are drawn.
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.
How to sort the observations. The default, YSORTBY=&XVAR, indicates that observations are sorted in ascending order of the response variable.
Label for y variable. If not specified, the vertical axis is labelled with the name of the YVAR= variable.
Vertical grouping variable. If specified, a grouped dot chart is produced with a separate panel for each value of the GROUP= variable.
format for printing group variable value (include the "." at the end of the format name).
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.
Line style for horizontal lines for each observation.
Color of horizontal lines
Name of an input variable giving length of error bar for each observation. If not specified, no error bars are drawn.
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


%include data(auto) ;
*include dotplot ;
proc format;
   value $origin  'A'='American'
goptions vpos= 80 hpos=80;
         xvar=mpg,  yvar=model,