p Charts with Revised Control Limits

/****************************************************************/
/*          S A S   S A M P L E   L I B R A R Y                 */
/*                                                              */
/*    NAME: SHWPEX4                                             */
/*   TITLE: p Charts with Revised Control Limits                */
/* 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 CircOne;
   input Batch Fail @@;
   datalines;
 1   7   2   6   3   6   4   9    5   2
 6  11   7   8   8   8   9   6   10  19
11   7  12   5  13   7  14   5   15   8
16  13  17   7  18  14  19  19   20   5
21   7  22   5  23   7  24   5   25  11
26   4  27   6  28   3  29  11   30   3
;


ods graphics on;
title 'Proportion of Circuit Failures';
proc shewhart data=CircOne;
   pchart Fail*Batch / subgroupn = 500
                       outindex  = 'Trial Limits'
                       outlimits = Faillim1
                       odstitle  = title;
run;

proc shewhart data=CircOne;
   where Batch ^= 10 and Batch ^= 19;
   pchart Fail*Batch / subgroupn = 500
                       nochart
                       outindex  ='Revised Limits'
                       outlimits = Faillim2;
run;


data Faillims;
   set Faillim1 Faillim2;
run;

title 'Proportion of Circuit Failures';
proc print data=Faillims noobs;
run;

title 'p Chart with Revised Limits for Failed Circuits';
proc shewhart data=CircOne limits=Faillims;
   pchart Fail*Batch / subgroupn  = 500
                       readindex  = 'Revised Limits'
                       vref       = 0.0156 0.032226
                       vreflabels = ('Trial P' 'Trial UCL')
                       vreflabpos = 3
                       odstitle   = title
                       nolegend;
   label Fail  = 'Fraction Failed'
         Batch = 'Batch Index';
run;
ods graphics off;