p Charts with Unequal Subgroup Sample Sizes

/****************************************************************/
/*          S A S   S A M P L E   L I B R A R Y                 */
/*                                                              */
/*    NAME: SHWPEX3                                             */
/*   TITLE: p Charts with Unequal Subgroup Sample Sizes         */
/* 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 Battery;
   length lot $3;
   input lot nFailed Sampsize @@;
   label nFailed  = 'Number Failed'
         lot      = 'Lot Number'
         Sampsize = 'Number Sampled';
   datalines;
AE3  6  151     AE4  5  142     AE9  6  145
BR3  9  149     BR7  3  150     BR8  0  156
BR9  4  150     DB1  9  158     DB2  4  152
DB3  0  162     DB5  9  140     DB6  7  161
DS4  6  154     DS6  1  144     DS8  5  154
JG1  3  151     MC3  8  148     MC4  2  143
MK6  4  150     MM1  4  147     MM2  0  150
RT5  2  154     RT9  8  149     SP1  3  160
SP3  9  153
;

ods graphics off;
title 'Proportion of Battery Failures';
proc shewhart data=Battery;
   pchart nFailed*Lot / subgroupn = Sampsize
                        turnhlabels
                        font      = 'Lucida Console'
                        outlimits = Batlim;
   label nFailed = 'Proportion Failed';
run;

title 'Control Limits for Battery Failures';
proc print data=Batlim noobs;
run;

title 'Proportion of Battery Failures';
proc shewhart data=Battery;
   pchart nFailed*Lot / subgroupn = Sampsize
                        limitn    = 150
                        alln
                        outlimits = Clim2
                        yscale    = percent;
   label nFailed = 'Percent Failed';
run;