Overview: BOXPLOT Procedure

The BOXPLOT procedure creates side-by-side box-and-whiskers plots of measurements organized in groups. A box-and-whiskers plot displays the mean, quartiles, and minimum and maximum observations for a group. Throughout this chapter, this type of plot, which can contain one or more box-and-whiskers plots, is referred to as a box plot.

The PLOT statement of the BOXPLOT procedure produces a box plot. You can specify more than one PLOT statement to produce multiple box plots. You can use options in the PLOT statement to do the following:

  • control the style of the box-and-whiskers plots

  • specify one of several methods for calculating quantile statistics (percentiles)

  • add block legends and symbol markers to reveal stratification in data

  • display vertical and horizontal reference lines

  • control axis values and labels

  • overlay the box plot with plots of additional variables

  • control the layout and appearance of the plot

The INSET and INSETGROUP statements produce boxes or tables (referred to as insets) of summary statistics or other data on a box plot. An INSET statement produces an inset of statistics pertaining to the entire box plot. An INSETGROUP statement produces an inset containing statistics calculated separately for each group. An INSET or INSETGROUP statement by itself does not produce a display; it must be used with a PLOT statement.

You can use options in an INSET or INSETGROUP statement to control insets in these ways:

  • specify the position of the inset

  • specify a header for the inset

  • specify graphical enhancements, such as background colors, text colors, text height, text font, and drop shadows

The BOXPLOT procedure can produce two kinds of graphical output:

  • traditional graphics

  • ODS Statistical Graphics output

Traditional graphics are saved in graphics catalogs with entry type GRSEG. Their appearance is controlled by global statements such as the GOPTIONS, AXIS, and SYMBOL statements (as described in SAS/GRAPH: Reference) and numerous specialized PLOT statement options. You must have a SAS/GRAPH® license to produce traditional graphics.

ODS Statistical Graphics (or ODS Graphics for short) is an extension to the Output Delivery System (ODS). Graphs are produced in standard image file formats (such as PNG) instead of graphics catalogs, and the details of their appearance and layout are controlled by ODS styles and templates rather than by global statements and procedure options.

When ODS Graphics is enabled (for example, with the ODS GRAPHICS ON statement) PROC BOXPLOT produces ODS Graphics output. Otherwise, it produces traditional graphics. See Chapter 21, Statistical Graphics Using ODS, for a thorough discussion of ODS Graphics.

See the section Getting Started: BOXPLOT Procedure for examples producing box plots via the traditional graphics system and ODS Graphics.

Note: Prior to SAS 9.2, traditional graphics produced by PROC BOXPLOT were extremely basic by default. Producing attractive graphical output required the careful selection of colors, fonts, and other elements, which were specified via SAS/GRAPH statements and PLOT statement options. Beginning with SAS 9.2, the default appearance of traditional box plots is governed by the prevailing ODS style, which automatically produces attractive, consistent output. You can specify the NOGSTYLE system option to prevent the ODS style from affecting the appearance of traditional graphs.