1. Home
  2. STEM procedure

STEM procedure

Produces a simple stem-and-leaf chart (J. Ollerton & S.A. Harding).

No options


DATA = variates Data values for each plot
NDIGITS = scalars Number of digits in the leaves of each plot
STEMUNITS = scalars Scale units for the stem values in each plot


STEM produces a simple stem-and-leaf chart of a variate of data. The stems indicate leading digits and the leaves indicate subsequent digits. By default, the leaves are formed from single digits; the parameter NDIGITS can be used to specify the number of digits in each leaf if more than one is required. The STEMUNITS parameter can be used to specify the units represented by the stem values. By default, this is determined from the data so that the display will fit within a single screen or page of output. Small values of STEMUNITS (in comparison to the range of the data) should be avoided as they may generate far too many lines of output. The display produced by STEM is restricted to the current output width; any lines that have to be truncated at the right-hand margin are terminated by >, indicating their continuation.

Options: none. Parameters: DATA, NDIGITS, STEMUNITS.


The variate of data is scaled appropriately and printed into a text. Using CONCATENATE the individual stem and leaf digits are extracted and then formed into another text structure which is printed out as the stem-and-leaf display. Missing values are excluded from the data.

Action with RESTRICT

STEM takes account of any restriction on the data variate.


Tukey, J.W. (1977). Exploratory Data Analysis. Addison-Wesley.

See also

Directive: DHISTOGRAM.


Commands for: Graphics.


CAPTION 'STEM example'; STYLE=meta
READ    [PRINT=errors] Prices
 250  150  795  895  696 1699 1499 1099 1693
1166  688 1333  895 1775  895 1895  795  806 :
PRINT   [ORIENT=across] Prices; DECIMALS=0
STEM    Prices; NDIGIT=1
STEM    Prices; NDIGIT=2
Updated on March 5, 2019

Was this article helpful?