Applying Tests with Multiple Control Limits

/****************************************************************/
/*          S A S   S A M P L E   L I B R A R Y                 */
/*                                                              */
/*    NAME: SHWTSC2                                             */
/*   TITLE: Applying Tests with Multiple Control Limits         */
/* PRODUCT: QC                                                  */
/*  SYSTEM: ALL                                                 */
/*    KEYS: Shewhart Charts, Test for Special Causes,           */
/*   PROCS: SHEWHART                                            */
/*    DATA:                                                     */
/*                                                              */
/*     REF: SAS/QC Software:  Usage and Reference, Version 6,   */
/*          First Edition, Volume 1 and Volume 2                */
/*                                                              */
/****************************************************************/

data Assembly;
   length System $ 1 comment $ 16;
   label Sample = 'Sample Number';
   input System Sample OffsetX OffsetR OffsetN comment $16. ;
   datalines;
T   1  19.80  3.8  5
T   2  17.16  8.3  5
T   3  20.11  6.7  5
T   4  20.89  5.5  5
T   5  20.83  2.3  5
T   6  18.87  2.6  5
T   7  20.84  2.3  5
T   8  23.33  5.7  5  New Tool
T   9  19.21  3.5  5
T  10  20.48  3.2  5
T  11  22.05  4.7  5
T  12  20.02  6.7  5
T  13  17.58  2.0  5
T  14  19.11  5.7  5
T  15  20.03  4.1  5
R  16  20.56  3.7  5  Changed System
R  17  20.86  3.3  5
R  18  21.10  5.6  5  Reset Tool
R  19  19.05  2.7  5
R  20  21.76  2.8  5
R  21  21.76  6.4  5
R  22  20.54  4.8  5
R  23  20.04  8.2  5
R  24  19.94  8.8  5
R  25  20.70  5.1  5
Q  26  21.40 12.1  7  Bad Reading
Q  27  21.32  3.2  7
Q  28  20.03  5.2  7  New Gauge
Q  29  22.02  5.9  7
Q  30  21.32  4.3  7
;


data Syslim;
   length _var_ $8 _subgrp_ $8 _type_ $8 _index_ $1;
   input _var_ _subgrp_ _index_ _type_ _mean_ _stddev_
         _limitn_ _sigmas_;
   datalines;
Offset Sample R standard 20.5 2.02 5 3
Offset Sample Q standard 20.2 2.35 7 3
Offset Sample T standard 20.0 2.24 5 3
;

ods graphics off;
title 'System-Specific Control Limits';
proc shewhart
   limits=Syslim
   history=Assembly (rename=(System=_phase_));
   xrchart Offset * Sample /
      tests       = 1 to 4
      testlabel   = ( comment )
      readindexes = ('T' 'R' 'Q')
      readphases  = ('T' 'R' 'Q')
      phaselegend
      phaseref
      phasebreak
      vaxis       = 16 to 26 by 2
      split       = '/' ;
   label OffsetX = 'Avg Offset in cm/Range';
run;

ods graphics off;
title 'System-Specific Control Limits';
proc shewhart
   limits=Syslim
   history=Assembly (rename=(System=_phase_));
   xrchart Offset * Sample /
      tests       = 1 to 4
      testlabel   = ( comment )
      testnmethod = standardize
      testacross
      readindexes = ('T' 'R' 'Q')
      readphases  = ('T' 'R' 'Q')
      phaselegend
      phaseref
      vaxis       = 16 to 26 by 2
      split       = '/';
   label OffsetX = 'Avg Offset in cm/Range';
run;