Previous Page | Next Page

The SHEWHART Procedure

Creating Charts for Medians and Ranges from Summary Data

[See SHWMR1 in the SAS/QC Sample Library]The previous example illustrates how you can create median and range charts using raw data (process measurements). However, in many applications, the data are provided as subgroup summary statistics. This example illustrates how you can use the MRCHART statement with data of this type.

The following data set (Detsum) provides the data from the preceding example in summarized form. There is exactly one observation for each subgroup (note that the subgroups are still indexed by Lot). The variable WeightM contains the subgroup medians, the variable WeightR contains the subgroup ranges, and the variable WeightN contains the subgroup sample sizes (these are all five).

data Detsum;
   input Lot WeightM WeightR;
   WeightN = 5;
datalines;
 1  22.56  9.54
 2  23.54  3.07
 3  24.35  4.65
 4  25.52  5.05
 5  23.25  8.04
 6  23.01  6.33
 7  24.19  2.19
 8  26.27  2.18
 9  22.31  6.08
10  22.66  8.21
11  26.38  4.97
12  23.01  5.05
13  23.15  5.37
14  24.73  4.95
15  25.86  5.58
16  23.99  4.35
17  24.30  5.24
18  24.88  4.87
19  25.92  7.22
20  25.63  6.30
21  25.17  6.52
22  26.72  5.18
23  23.67  9.17
24  24.92  4.62
25  24.51  5.40
26  24.75  3.41
27  25.10  4.76
28  25.64  3.47
;
run;

A partial listing of Detsum is shown in Figure 13.15.5.

Output 13.15.5 The Summary Data Set Detsum
Summary Data for Detergent Box Weights

Lot WeightM WeightR WeightN
1 22.56 9.54 5
2 23.54 3.07 5
3 24.35 4.65 5
4 25.52 5.05 5
5 23.25 8.04 5

You can read this data set by specifying it as a HISTORY= data set in the PROC SHEWHART statement, as follows:

options nogstyle;
symbol color = rose h = .8;
title 'Median and Range Charts for Weights';
proc shewhart history=Detsum;
   mrchart Weight*Lot / cframe   = vipb
                        cinfill  = ywh
                        cconnect = rose
                        coutfill = salmon;
run;
options gstyle;

The NOGSTYLE system option causes ODS styles not to affect traditional graphics. Instead, the SYMBOL statement and MRCHART statement options control the appearance of the graph. The GSTYLE system option restores the use of ODS styles for traditional graphics produced subsequently. The charts are shown in Figure 13.15.6.

Output 13.15.6 Median and Range Charts from Summary Data Set Detsum (Traditional Graphics with NOGSTYLE)
Median and Range Charts from Summary Data Set Detsum (Traditional Graphics with NOGSTYLE)

Note that Weight is not the name of a SAS variable in the data set Detsum but is, instead, the common prefix for the names of the three SAS variables WeightM, WeightR, and WeightN. The suffix characters M, R, and N indicate median, range, and sample size, respectively. This naming convention enables you to specify three subgroup summary variables in the HISTORY= data set with a single name (Weight), referred to as the process. The name Lot specified after the asterisk is the name of the subgroup-variable.

In general, a HISTORY= input data set used with the MRCHART statement must contain the following variables:

  • subgroup variable

  • subgroup median variable

  • subgroup range variable

  • subgroup sample size variable

Furthermore, the names of the subgroup median, range, and sample size variables must begin with the prefix process specified in the MRCHART statement and end with the special suffix characters M, R, and N, respectively. If the names do not follow this convention, you can use the RENAME option to rename the variables for the duration of the SHEWHART procedure step. Suppose that, instead of the variables WeightM, WeightR, and WeightN, the data set Detsum contained summary variables named medians, ranges, and sizes. The following statements would temporarily rename medians, ranges, and sizes to WeightM, WeightR, and WeightN, respectively:

proc shewhart
   history=Detsum (rename=(medians = WeightM
                           ranges  = WeightR
                           sizes   = WeightN ));
   mrchart Weight*Lot;
run;

In summary, the interpretation of process depends on the input data set:

  • If raw data are read using the DATA= option (as in the previous example), process is the name of the SAS variable containing the process measurements.

  • If summary data are read using the HISTORY= option (as in this example), process is the common prefix for the names containing the summary statistics.

For more information, see HISTORY= Data Set.

Previous Page | Next Page | Top of Page