Control Chart for the Subgroup Maximum

/****************************************************************/
/*          S A S   S A M P L E   L I B R A R Y                 */
/*                                                              */
/*    NAME: SHWBOX3                                             */
/*   TITLE: Control Chart for the Subgroup Maximum              */
/* PRODUCT: QC                                                  */
/*  SYSTEM: ALL                                                 */
/*    KEYS: Shewhart Charts, Box Charts,                        */
/*   PROCS: SHEWHART                                            */
/*    DATA:                                                     */
/*                                                              */
/*     REF: SAS/QC Software:  Usage and Reference, Version 6,   */
/*          First Edition, Volume 1 and Volume 2                */
/*    MISC:                                                     */
/*                                                              */
/****************************************************************/

data LengthData;
   informat Day date7.;
   format Day date5.;
   label Length='Brace Length (cm)';
   input Day @;
   do i=1 to 5;
      input Length @;
      output;
   end;
   drop i;
   datalines;
02JAN86  113.64  119.60  111.66  111.88  125.29
02JAN86  114.08  115.28  127.84  109.97  109.34
02JAN86  109.65  121.76  112.17  116.01  111.64
02JAN86  112.70  114.43  110.27  114.76  125.89
03JAN86  115.92  113.62  117.52  114.44  118.08
03JAN86  111.13  118.42  112.16  112.25  107.71
03JAN86  110.46  113.78  109.89  114.59  116.98
03JAN86  111.06  113.76  115.53  110.88  115.47
04JAN86  111.77  111.34  123.67  111.95  110.74
04JAN86  112.77  111.13  132.96  114.00  108.52
04JAN86  116.07  117.08  113.62  111.34  112.87
04JAN86  112.54  111.98  115.68  114.98  118.77
05JAN86  112.79  111.34  115.64  110.21  110.56
05JAN86  118.16  111.62  112.85  120.41  116.25
05JAN86  114.88  111.79  115.78  111.31  113.09
05JAN86  114.14  122.50  114.92  117.36  108.97
06JAN86  122.26  115.42  111.16  111.11  109.93
06JAN86  111.67  114.18  115.16  114.36  121.70
06JAN86  115.71  126.47  116.95  110.89  121.89
06JAN86  112.65  117.99  109.30  110.57  119.58
07JAN86  115.70  111.66  110.69  109.65  113.34
07JAN86  112.97  114.59  112.05  111.93  110.87
07JAN86  113.45  110.57  118.91  115.40  111.13
07JAN86  110.07  114.76  113.77  114.57  113.72
08JAN86  111.53  111.80  114.77  114.66  113.38
08JAN86  109.95  111.40  114.65  114.97  111.28
08JAN86  115.98  115.73  113.98  111.91  114.08
08JAN86  109.48  117.59  111.66  113.56  111.54
09JAN86  114.39  111.22  113.50  115.97  114.08
09JAN86  115.03  113.92  108.91  113.13  139.72
09JAN86  117.13  110.45  111.85  115.88  109.69
09JAN86  113.12  119.35  120.63  112.01  118.27
10JAN86  115.20  115.62  109.95  110.50  120.21
10JAN86  116.08  112.62  108.15  114.72  118.70
10JAN86  121.34  108.64  110.13  109.76  107.80
10JAN86  111.47  113.19  112.12  118.65  118.83
11JAN86  115.06  115.58  116.85  113.39  110.89
11JAN86  111.55  123.55  118.61  110.42  113.24
11JAN86  118.53  112.56  109.56  120.71  109.23
11JAN86  109.15  118.81  110.50  109.41  114.02
12JAN86  113.59  110.12  112.73  110.74  111.31
12JAN86  115.77  115.59  120.29  123.98  113.72
12JAN86  112.24  110.43  111.00  117.08  110.19
12JAN86  113.49  114.73  115.86  115.15  118.77
13JAN86  112.63  124.21  110.21  110.91  110.97
13JAN86  110.75  118.23  118.71  108.87  113.05
13JAN86  113.12  112.87  117.31  118.50  110.42
13JAN86  116.35  111.73  114.78  108.99  112.31
14JAN86  111.25  111.96  115.22  112.55  111.86
14JAN86  115.70  114.71  114.63  110.32  111.44
14JAN86  109.38  114.49  126.05  120.33  108.50
14JAN86  113.74  119.61  116.33  116.52  122.48
15JAN86  108.97  114.04  113.37  111.80  116.36
15JAN86  122.24  112.56  117.45  117.72  111.74
15JAN86  112.60  112.54  115.22  116.36  115.44
15JAN86  118.54  110.93  115.40  123.24  113.80
16JAN86  111.94  111.27  109.66  121.92  121.51
16JAN86  111.45  111.73  114.74  112.55  113.14
16JAN86  114.94  112.97  109.84  113.86  118.40
16JAN86  110.92  113.25  113.85  109.06  111.96
17JAN86  115.74  112.62  110.38  112.53  112.87
17JAN86  117.68  124.26  110.56  110.27  116.65
17JAN86  110.86  118.83  129.58  112.57  111.44
17JAN86  111.58  111.36  110.92  112.27  125.86
18JAN86  125.50  107.41  110.21  116.66  112.21
18JAN86  110.21  117.66  118.75  114.63  116.42
18JAN86  112.72  110.00  108.32  110.57  111.47
18JAN86  110.68  119.02  124.54  115.63  111.91
19JAN86  119.66  134.14  114.04  116.34  122.44
19JAN86  116.78  112.11  110.42  112.91  114.05
19JAN86  116.00  112.75  116.42  114.88  114.89
19JAN86  111.90  111.30  112.34  114.20  112.66
20JAN86  112.84  109.01  110.03  114.44  115.21
20JAN86  115.15  112.34  114.99  109.70  111.20
20JAN86  117.81  119.51  109.03  111.61  118.01
20JAN86  113.55  114.78  112.91  111.87  118.54
;



data LengthData;
   set LengthData;
   LogLength=log(Length-105);
run;

proc shewhart data=LengthData;
   xchart LogLength*Day /
      nochart
      outlimits=Logllims;
run;

data Maxlim;
   set LengthData;
   set Logllims;
   drop expmax stdmax;
   label _lclx_ = 'Lower Limit for Maximum of 20'
         _uclx_ = 'Upper Limit for Maximum of 20'
         _mean_ = 'Central Line for Maximum of 20';
   expmax = _stddev_*1.86748 + _mean_;
   stdmax = _stddev_*0.52507;
   _lclx_ = expmax - _sigmas_*stdmax;
   _uclx_ = expmax + _sigmas_*stdmax;
   _mean_ = expmax;
   call symput('avgmax',left(put(expmax,8.1)));
run;

ods graphics off;
title 'Box Chart With Control Limits for the Subgroup Maximum';
symbol v=none;
proc shewhart data=LengthData limits=Maxlim;
   boxchart LogLength*Day /
      ranges
      serifs
      nohlabel
      nolegend
      xsymbol="Avg Max=&AVGMAX" ;
   label LogLength='Values of LogLength';
run;