Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
PCHART Statement

Creating p Charts from Summary Data

See SHWPCHR in the SAS/QC Sample Library

The previous example illustrates how you can create p charts using raw data (counts of nonconforming items). However, in many applications, the data are provided in summarized form as proportions or percentages of nonconforming items. This example illustrates how you can use the PCHART statement with data of this type.

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

   data cirprop;
      input batch pfailed @@;
      sampsize=500;
   datalines;
    1  0.010   2  0.012   3  0.022   4  0.012   5  0.008
    6  0.018   7  0.034   8  0.020   9  0.024  10  0.018
   11  0.016  12  0.014  13  0.014  14  0.030  15  0.016
   16  0.036  17  0.024  18  0.032  19  0.008  20  0.014
   21  0.034  22  0.024  23  0.016  24  0.014  25  0.030
   26  0.012  27  0.016  28  0.024  29  0.014  30  0.018
   ;

A listing of CIRPROP is shown in Figure 38.4. The subgroups are still indexed by BATCH. The variable PFAILED contains the proportions of nonconforming items, and the variable SAMPSIZE contains the subgroup sample sizes.

 
Subgroup Proportions of Nonconforming Items

batch pfailed sampsize
1 0.010 500
2 0.012 500
3 0.022 500
4 0.012 500
5 0.008 500
6 0.018 500
7 0.034 500
8 0.020 500
9 0.024 500
10 0.018 500
11 0.016 500
12 0.014 500
13 0.014 500
14 0.030 500
15 0.016 500
16 0.036 500
17 0.024 500
18 0.032 500
19 0.008 500
20 0.014 500
21 0.034 500
22 0.024 500
23 0.016 500
24 0.014 500
25 0.030 500
26 0.012 500
27 0.016 500
28 0.024 500
29 0.014 500
30 0.018 500
Figure 38.4: The Data Set CIRPROP

The following statements create a p chart identical to the one in Figure 38.2:

   title 'p Chart for the Proportion of Failing Circuits';
   symbol v=dot;
   proc shewhart data=cirprop;
      pchart pfailed*batch / subgroupn=sampsize
                             dataunit =proportion;
   label pfailed = 'Proportion for FAIL';
   run;

The DATAUNIT= option specifies that the values of the process (PFAILED) are proportions of nonconforming items. By default, the values of the process are assumed to be counts of nonconforming items (see the previous example).

Alternatively, you can read the data set CIRPROP by specifying it as a HISTORY= data set in the PROC SHEWHART statement. A HISTORY= data set used with the PCHART statement must contain the following variables:


Furthermore, the names of the subgroup proportion and sample size variables must begin with the process name specified in the PCHART statement and end with the special suffix characters P and N, respectively.

To specify CIRPROP as a HISTORY= data set and FAIL as the process, you must rename the variables PFAILED and SAMPSIZE to FAILP and FAILN, respectively. The following statements temporarily rename PFAILED and SAMPSIZE for the duration of the procedure step:

   title 'p Chart for the Proportion of Failing Circuits';
   proc shewhart history=cirprop lineprinter (rename=(pfailed =failp
                                                      sampsize=failn ));
      pchart fail*batch='*';
   run;

The resulting p chart is shown in Figure 38.5. 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.

 
p Chart for the Proportion of Failing Circuits

                                                               3 Sigma Limits       
                                                               For n=500:           
       P       ----------------------------------------------                       
       r 0.04 +                                              |                      
       o      |==============================================| UCL = .038           
       p      |           *            *       *             |                      
       o      |           +            ++ *    +             |                      
       r 0.03 +          ++         *  ++ +    ++    *       |                      
       t      |          ++         +  + ++   + +    +       |                      
       i      |          + + *      ++ + * +  + *   ++   *   |                      
       o      |     *    + +++      +++    +  +  +  ++   ++  | -                    
       n 0.02 +-----+---+--*--+----+-++----+--+--+--+-+--++--| P = .019             
              |    + +  *     *+   +  +    + +    ++  + +  +*|                      
       f      |    + +  +       **+*  *    + *    **  ++*  * |                      
       o      |   *  *  +                   ++        *      |                      
       r 0.01 +  *    ++                    +                |                      
              |        *                    *                |                      
       f      |                                              |                      
       a      |                                              |                      
       i    0 +==============================================| LCL = .001           
       l       +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+                       
               0     4     8    12    16    20    24    28                          
                                                                                    
                           Subgroup Index (batch)                                   
                                                                                    
       Subgroup Sizes:  * n=500                                                     
Figure 38.5: A p Chart from Subgroup Proportions

In this example, it is more convenient to use CIRPROP as a DATA= data set than as a HISTORY= data set. In general, it is more convenient to use the HISTORY= option for input data sets that have been previously created by the SHEWHART procedure as OUTHISTORY= data sets, as illustrated in the next example. 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.