Displaying Multiple Sets of Control Limits

/****************************************************************/
/*          S A S   S A M P L E   L I B R A R Y                 */
/*                                                              */
/*    NAME: SHWCLMS                                             */
/*   TITLE: Displaying Multiple Sets of Control Limits          */
/* PRODUCT: QC                                                  */
/*  SYSTEM: ALL                                                 */
/*    KEYS: Shewhart Charts, Multiple Sets of Control Limits,   */
/*   PROCS: SHEWHART                                            */
/*    DATA:                                                     */
/*                                                              */
/*     REF: SAS/QC Software:  Usage and Reference, Version 6,   */
/*          First Edition, Volume 1 and Volume 2                */
/*                                                              */
/****************************************************************/

data Flange;
   input @4 Day date7. Sample 13-14 _phase_ $17-26
         FlwidthX FlwidthR FlwidthN;
   format Day date7.;
   datalines;
   08FEB90   6  Production  0.97360  0.06247  5
   09FEB90   7  Production  1.00486  0.11478  5
   10FEB90   8  Production  1.00251  0.13537  5
   11FEB90   9  Production  0.95509  0.08378  5
   12FEB90  10  Production  1.00348  0.09993  5
   15FEB90  11  Production  1.02566  0.06766  5
   16FEB90  12  Production  0.97053  0.07608  5
   17FEB90  13  Production  0.94713  0.10170  5
   18FEB90  14  Production  1.00377  0.04875  5
   19FEB90  15  Production  0.99604  0.08242  5
   22FEB90  16  Change 1    0.99218  0.09787  5
   23FEB90  17  Change 1    0.99526  0.02017  5
   24FEB90  18  Change 1    1.02235  0.10541  5
   25FEB90  19  Change 1    0.99950  0.11476  5
   26FEB90  20  Change 1    0.99271  0.05395  5
   01MAR90  21  Change 1    0.98695  0.03833  5
   02MAR90  22  Change 1    1.00969  0.06183  5
   03MAR90  23  Change 1    0.98791  0.05836  5
   04MAR90  24  Change 1    1.00170  0.05243  5
   05MAR90  25  Change 1    1.00412  0.04815  5
   08MAR90  26  Change 2    1.00261  0.05604  5
   09MAR90  27  Change 2    0.99553  0.02818  5
   10MAR90  28  Change 2    1.01463  0.05558  5
   11MAR90  29  Change 2    0.99812  0.03648  5
   12MAR90  30  Change 2    1.00047  0.04309  5
   15MAR90  31  Change 2    0.99714  0.03689  5
   16MAR90  32  Change 2    0.98642  0.04809  5
   17MAR90  33  Change 2    0.98891  0.07777  5
   18MAR90  34  Change 2    1.00087  0.06409  5
   19MAR90  35  Change 2    1.00863  0.02649  5
;

proc print data=Flange;
   var _phase_ Day Sample FlwidthX FlwidthR FlwidthN;
run;

data Flangelim;
   input _index_ $1-11 _lclx_ _mean_ _uclx_ _r_ _uclr_ _stddev_;
   _var_    = 'Flwidth ';
   _subgrp_ = 'Sample  ';
   _type_   = 'ESTIMATE';
   _limitn_ = 5;
   _sigmas_ = 3;
   _alpha_  = .0026998;
   _lclr_   = 0;
   datalines;
Change 1     0.96167 0.99924 1.03680 0.06513 0.13771 0.028000
Production   0.93792 0.98827 1.03862 0.08729 0.18458 0.037530
Start        0.87088 0.96803 1.06517 0.16842 0.35612 0.072409
;

proc print data=Flangelim;
   var _index_ _var_ _subgrp_ _type_ _limitn_ _alpha_ _sigmas_
       _lclx_ _mean_ _uclx_ _lclr_ _r_ _uclr_ _stddev_;
run;

ods graphics on;
proc shewhart history=Flange limits=Flangelim;
   xchart Flwidth*Sample /
      readphase = ('Change 1' 'Change 2')
      readindex = ('Production')
      phaseref
      phaselegend;
run;

proc shewhart history=Flange limits=Flangelim;
   xchart Flwidth*Sample /
      readphase = all
      readindex = ('Production' 'Change 1')
      phaseref
      phaselegend;
run;

proc shewhart history=Flange limits=Flangelim;
   xchart Flwidth*Sample /
      readphases  = ('Production' 'Change 1')
      readindexes = ('Production' 'Change 1')
      phaseref
      phaselegend;
run;

proc shewhart history=Flange limits=Flangelim;
   xchart Flwidth*Sample /
      readphases  = ('Production' 'Change 1')
      readindexes = all
      phaseref
      phaselegend ;
run;

proc shewhart history=Flange limits=Flangelim;
   xchart Flwidth*Sample /
      readphase = all
      readindex = all
      phaseref
      phaselegend ;
run;

proc shewhart history=Flange limits=Flangelim;
   xchart Flwidth*Sample /
      readphases = ('Production' 'Change 1')
      phaseref
      phaselegend;
run;

proc shewhart history=Flange limits=Flangelim;
   xchart Flwidth*Sample /
      readphase = all
      phaseref
      phaselegend;
run;