Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
MCHART Statement

Creating Charts for Medians from Subgroup Summary Data

See SHWMCHR in the SAS/QC Sample Library

The previous example illustrates how you can create median 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 MCHART 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
   ;
A listing of DETSUM is shown in Figure 35.3.

 
Summary Data Set 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
6 23.01 6.33 5
7 24.19 2.19 5
8 26.27 2.18 5
9 22.31 6.08 5
10 22.66 8.21 5
11 26.38 4.97 5
12 23.01 5.05 5
13 23.15 5.37 5
14 24.73 4.95 5
15 25.86 5.58 5
16 23.99 4.35 5
17 24.30 5.24 5
18 24.88 4.87 5
19 25.92 7.22 5
20 25.63 6.30 5
21 25.17 6.52 5
22 26.72 5.18 5
23 23.67 9.17 5
24 24.92 4.62 5
25 24.51 5.40 5
26 24.75 3.41 5
27 25.10 4.76 5
28 25.64 3.47 5
Figure 35.3: The Summary Data Set DETSUM

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

   title 'Median Chart for Weights';
   proc shewhart history=detsum lineprinter;
      mchart weight*lot='*';
   run;

The resulting median chart is shown in Figure 35.4. Since the LINEPRINTER option is included in the PROC SHEWHART statement, line printer output is produced. The asterisk (*) specified in single quotes after the subgroup-variable indicates the character used to plot points. This character must follow an equal sign.

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. Thus, you can specify three subgroup summary variables in the HISTORY= data set with a single name (WEIGHT), which is referred to as the process. The name LOT specified after the asterisk is the name of the subgroup-variable.

 
Median Chart for Weights

                                                                   3 Sigma Limits   
                                                                   For n=5:         
        ---------------------------------------------------------                   
    30 +                                                         |                  
       |                                                         |                  
  M    |                                                         |                  
  e    |                                                         |                  
  d 28 +=========================================================| UCL = 28.2       
  i    |                                                         |                  
  a    |                                                         |                  
  n    |                *     *                     *            |                  
    26 +                +     +       *       *+   ++            |                  
  o    |        *      + +    ++     + +     +  *+ + +         +*|                  
  f    |       + +     + +   + +     + +   +*     *  +  *+ +*+*  | -                
       |------*--+----+--+---+-+----*---++*----------+-+--*------| M = 24.5         
  w 24 +     +    +   *  +   + +   +    *             ++         |                  
  e    |    *     *+ +    +  +  +  +                  *          |                  
  i    |   +        *     + +   *+*                              |                  
  g    |  *               *+*                                    |                  
  h 22 +                                                         |                  
  t    |                                                         |                  
       |=========================================================| LCL = 20.8       
       |                                                         |                  
    20 +                                                         |                  
        +---+---+---+---+---+---+---+---+---+---+---+---+---+---+                   
        0   2   4   6   8  10  12  14  16  18  20  22  24  26  28                   
                                                                                    
                          Subgroup Index (lot)                                      
                                                                                    
  Subgroup Sizes:  * n=5                                                            
Figure 35.4: Median Chart from the Summary Data Set DETSUM

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

Furthermore, the names of the subgroup median, range (or standard deviation), and sample size variables must begin with the process name specified in the MCHART statement and end with the special suffix characters M, R (or S), and N, respectively. If the names do not follow this convention, you can use the RENAME option in the PROC SHEWHART statement to rename the variables for the duration of the SHEWHART procedure step (see "Creating Charts for Medians and Ranges from Summary Data" ).

If you specify the STDDEVIATIONS option in the MCHART statement, the HISTORY= data set must contain a subgroup standard deviation variable; otherwise, the HISTORY= data set must contain a subgroup range variable. The STDDEVIATIONS option specifies that the estimate of the process standard deviation \sigma is to be calculated from subgroup standard deviations rather than subgroup ranges. For example, in the following statements, the data set DETSUM2 must contain a subgroup standard deviation variable named WEIGHTS:

   title 'Median Chart for Weights';
   symbol v=dot;
   proc shewhart history=detsum2;
      mchart weight*lot / stddeviations;
   run;

Options such as STDDEVIATIONS are specified after the slash (/) in the MCHART statement. A complete list of options is presented in the "Syntax" section.

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


For more information, see "HISTORY= Data Set" .

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.