Resources

p Chart Examples

/****************************************************************/
/*          S A S   S A M P L E   L I B R A R Y                 */
/*                                                              */
/*    NAME: SHWPCHR                                             */
/*   TITLE: p Chart Examples                                    */
/* PRODUCT: QC                                                  */
/*  SYSTEM: ALL                                                 */
/*    KEYS: Shewhart Charts, p Charts,                          */
/*   PROCS: SHEWHART                                            */
/*    DATA:                                                     */
/*                                                              */
/*     REF: SAS/QC Software:  Usage and Reference, Version 6,   */
/*          First Edition, Volume 1 and Volume 2                */
/*                                                              */
/****************************************************************/

data Circuits;
   input Batch Fail @@;
   datalines;
1    5   2   6   3  11   4   6    5   4
6    9   7  17   8  10   9  12   10   9
11   8  12   7  13   7  14  15   15   8
16  18  17  12  18  16  19   4   20   7
21  17  22  12  23   8  24   7   25  15
26   6  27   8  28  12  29   7   30   9
;


title 'Number of Failing Circuits';
proc print data=Circuits(obs=5) noobs;
run;

ods graphics off;
title 'p Chart for the Proportion of Failing Circuits';
proc shewhart data=Circuits;
   pchart Fail*Batch / subgroupn = 500;
run;

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
;

title 'Subgroup Proportions of Nonconforming Items';
proc print data=Cirprop(obs=5) noobs;
run;

options nogstyle;
goptions ftext='albany amt';
title 'p Chart for the Proportion of Failing Circuits';
proc shewhart history=Cirprop(rename=(pFailed=FailP
                              Sampsize=FailN ));
   pchart Fail*Batch / cframe    = lib
                       cinfill   = bwh
                       coutfill  = yellow
                       cconnect  = salmon;
run;
options gstyle;

proc shewhart data=Circuits;
   pchart Fail*Batch / subgroupn  = 500
                       outhistory = Cirhist
                       nochart ;
run;

title 'Subgroup Proportions and Control Limit Information';
proc print data=Cirhist(obs=5) noobs;
run;

proc shewhart data=Circuits;
   pchart Fail*Batch / subgroupn = 500
                       outlimits = Cirlim
                       nochart ;
run;

options ls=80;
title 'Control Limits for the Proportion of Failing Circuits';
proc print data=Cirlim noobs;
run;
options ls=76;

proc shewhart data=Circuits;
   pchart Fail*Batch / subgroupn = 500
                       outtable  = Cirtable
                       nochart ;
run;

options ls=80;
title 'Subgroup Proportions and Control Limit Information';
proc print data=Cirtable noobs;
run;
options ls=76;

title 'p Chart for the Proportion of Failing Circuits';
proc shewhart table=Cirtable;
   pchart Fail*Batch;
run;

data Circuit2;
   input Batch Fail @@;
   datalines;
31  12   32   9   33  16   34   9
35   3   36   8   37  20   38   4
39   8   40   6   41  12   42  16
43   9   44   2   45  10   46   8
47  14   48  10   49  11   50   9
;

ods graphics on;
title 'p Chart for the Proportion of Failing Circuits';
proc shewhart data=Circuit2 limits=Cirlim;
   pchart Fail*Batch / subgroupn = 500
                       odstitle  = title;
run;