Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
XCHART Statement

Creating Charts for Means from Subgroup Summary Data

See SHWXCHR in the SAS/QC Sample Library

The previous example illustrates how you can create \bar{X}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 XCHART statement with data of this type.

The following data set (PARTS) provides the data from the preceding example in summarized form:

   data parts;
      input sample partgapx partgapr;
      partgapn=5;
      label partgapx='Mean of Gap Width'
            sample  ='Sample Index';
      datalines;

    1  270  35
    2  258  25
    3  248  24
    4  260  39
    5  273  29
    6  260  21
    7  259  37
    8  248  37
    9  260  28
   10  255  19
   11  268  36
   12  253  36
   13  273  29
   14  275  22
   15  257  24
   16  269  41
   17  249  36
   18  264  31
   19  258  25
   20  248  36
   21  248  30
   ;

A listing of PARTS is shown in Figure 42.3. There is exactly one observation for each subgroup (note that the subgroups are still indexed by SAMPLE). The variable PARTGAPX contains the subgroup means, the variable PARTGAPR contains the subgroup ranges, and the variable PARTGAPN contains the subgroup sample sizes (these are all five).

 
The Data Set PARTS

sample partgapx partgapr partgapn
1 270 35 5
2 258 25 5
3 248 24 5
4 260 39 5
5 273 29 5
6 260 21 5
7 259 37 5
8 248 37 5
9 260 28 5
10 255 19 5
11 268 36 5
12 253 36 5
13 273 29 5
14 275 22 5
15 257 24 5
16 269 41 5
17 249 36 5
18 264 31 5
19 258 25 5
20 248 36 5
21 248 30 5
Figure 42.3: The Summary Data Set PARTS

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

   title 'Mean Chart for Gap Width';
   proc shewhart history=parts lineprinter;
      xchart partgap*sample='*';
   run;

The resulting \bar{X} chart is shown in Figure 42.4. Since the LINEPRINTER option is specified 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 PARTGAP 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 PARTGAPX, PARTGAPR, and PARTGAPN. The suffix characters X, R, and N indicate mean, range, and sample size, respectively. Thus, you can specify three subgroup summary variables in a HISTORY= data set with a single name (PARTGAP), which is referred to as the process. The name SAMPLE specified after the asterisk is the name of the subgroup-variable.

 
Mean Chart for Gap Width

                                                                     3 Sigma Limits     
                                                                     For n=5:           
           --------------------------------------------------------                     
    M 280 +                                                        |                    
    e     |========================================================| UCL = 277.2        
    a     |                                  +*                    |                    
    n     |             *                   * +                    |                    
      270 +   *        ++                   +  +   *               |                    
    o     |   +        + +             *   +   +   +               |                    
    f     |    +      +  +            ++   +    + + +   *          |                    
          |    +      +   +           + +  +    + + +   ++         | =                  
    G 260 +-----+----*----*++*----*--+--+-+------+---+-+--+--------| X = 259.7          
    a     |     *    +       +   + + +  + +      *   + +   *       |                    
    p     |      +  +         +  +  *    +           + +    +      |                    
          |       + +         + +        *            +     +      |                    
    W 250 +       ++           ++                     *      +     |                    
    i     |        *           *                             *++*  |                    
    d     |                                                        |                    
    t     |========================================================| LCL = 242.1        
    h 240 +                                                        |                    
           +----+----+----+----+----+----+----+----+----+----+----+                     
           0    2    4    6    8   10   12   14   16   18   20   22                     
                                                                                        
                                 Sample Index                                           
                                                                                        
    Subgroup Sizes:  * n=5                                                              
Figure 42.4: \bar{X} Chart from the Summary Data Set PARTS

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


Furthermore, the names of the subgroup mean, range (or standard deviation), and sample size variables must begin with the process name specified in the XCHART statement and end with the special suffix characters X, 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 Means and Ranges from Summary Data" ).

If you specify the STDDEVIATIONS option in the XCHART 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 PARTS2 must contain a subgroup standard deviation variable named PARTGAPS:

   title 'Mean Chart for Gap Width';
   proc shewhart history=parts2;
      xchart partgap*sample='*' / stddeviations;
   run;

Options such as STDDEVIATIONS are specified after the slash (/) in the XCHART 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.