Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
MACHART Statement

Creating Moving Average Charts from Subgroup Summary Data

See MACMA1 in the SAS/QC Sample Library

The previous example illustrates how you can create moving average 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 MACHART statement with data of this type. The following data set (CLIPSUM) provides the data from the preceding example in summarized form:

   data clipsum;
      input day gapx gaps;
      gapn=5;
   datalines;
    1  14.904  0.18716
    2  15.014  0.09317
    3  14.866  0.25006
    4  15.048  0.23732
    5  15.024  0.26792
    6  15.126  0.12260
    7  15.220  0.23098
    8  14.902  0.17254
    9  14.910  0.19824
   10  14.932  0.24035
   11  15.096  0.25618
   12  14.912  0.16903
   13  15.138  0.15928
   14  14.798  0.26329
   15  14.944  0.20876
   16  14.896  0.09965
   17  14.734  0.22512
   18  15.046  0.24141
   19  14.702  0.17880
   20  14.788  0.16634
   ;

A listing of CLIPSUM is shown in Figure 21.3. There is exactly one observation for each subgroup (note that the subgroups are still indexed by DAY). The variable GAPX contains the subgroup means, the variable GAPS contains the subgroup standard deviations, and the variable GAPN contains the subgroup sample sizes (these are all five).

 
The Data Set CLIPSUM

day gapx gaps gapn
1 14.904 0.18716 5
2 15.014 0.09317 5
3 14.866 0.25006 5
4 15.048 0.23732 5
5 15.024 0.26792 5
6 15.126 0.12260 5
7 15.220 0.23098 5
8 14.902 0.17254 5
9 14.910 0.19824 5
10 14.932 0.24035 5
11 15.096 0.25618 5
12 14.912 0.16903 5
13 15.138 0.15928 5
14 14.798 0.26329 5
15 14.944 0.20876 5
16 14.896 0.09965 5
17 14.734 0.22512 5
18 15.046 0.24141 5
19 14.702 0.17880 5
20 14.788 0.16634 5
Figure 21.3: The Summary Data Set CLIPSUM

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


   title 'Moving Average Chart for Gap Measurements';
   proc macontrol history=clipsum lineprinter;
      machart gap*day='*' / span=3;
   run;

The resulting moving average chart is shown in Figure 21.4. Since the LINEPRINTER option is specified in the PROC MACONTROL 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 GAP is not the name of a SAS variable in the data set but is, instead, the common prefix for the names of the three SAS variables GAPX, GAPS, and GAPN. The suffix characters X, S, and N indicate mean, standard deviation, and sample size, respectively. Thus, you can specify three subgroup summary variables in a HISTORY= data set with a single name (GAP), which is referred to as the process. The variables GAPX, GAPS, and GAPN are all required. The name DAY specified after the asterisk is the name of the subgroup-variable.

 
Moving Average Chart for Gap Measurements

                                                                 3 Sigma Limits     
                                                                 For n=5:           
            ---------------------------------------------------                     
      15.4 +                                                   |                    
           |                                                   |                    
           |                                                   |                    
           |                                                   |                    
           |                                                   |                    
           |                                                   |                    
    M      |=====                                              |                    
    o 15.2 +    |                                              |                    
    v      |    |                                              |                    
    i      |    ===                                            |                    
    n      |      ============*+===============================| UCL                
    g      |                ++  *                              |                    
           |               *     +           *                 |                    
    A      |              +       +         + +                |                    
    v 15.0 +              +        *       +  +                |                    
    g      |     *    *++*          +   *+*    + +*            | =                  
           |----+-++-+--------------+-++-------*+--+-----------| X = 14.95          
    o      |   *    *                *             +           |                    
    f      |                                        *+  +*     |                    
           |                                          +*  ++ +*|                    
    g      |                                                *  |                    
    a 14.8 +      =============================================| LCL                
    p      |      |                                            |                    
           |    ===                                            |                    
           |    |                                              |                    
           |    |                                              |                    
           |=====                                              |                    
           |                                                   |                    
      14.6 +                                                   |                    
            +----+----+----+----+----+----+----+----+----+----+                     
            0    2    4    6    8   10   12   14   16   18   20                     
                                                                                    
                           Subgroup Index (day)                                     
                                                                                    
    Subgroup Sizes:  * n=5   Span=3                                                 
Figure 21.4: Uniformly Weighted Moving Average Chart from Summary Data

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


Furthermore, the names of subgroup mean, standard deviation, and sample size variables must begin with the process name specified in the MACHART statement and end with the special suffix characters X, S, and N, respectively. If the names do not follow this convention, you can use the RENAME option in the PROC MACONTROL statement to rename the variables for the duration of the MACONTROL procedure step.

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.