Applying Tests Based on General Patterns

/****************************************************************/
/*          S A S   S A M P L E   L I B R A R Y                 */
/*                                                              */
/*    NAME: SHWTSC4                                             */
/*   TITLE: Applying Tests Based on General Patterns            */
/* 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
;


ods graphics off;
title 'Analysis of Assembly Data';
proc shewhart history=Assembly;
   xrchart Offset * Sample /
      mu0       = 20
      sigma0    = 2.24
      limitn    = 5
      alln
      tests     = 1
                  t( k=14 m=17
                     lower=0 upper=. scheme=twosided
                     code=A label='Test A' )
                  3 4
      vaxis     = 16 to 26 by 2
      split     = '/' ;
   label OffsetX = 'Avg Offset in cm/Range';
run;