Median Chart Example 1

/****************************************************************/
/*          S A S   S A M P L E   L I B R A R Y                 */
/*                                                              */
/*    NAME: SHWMEX1                                             */
/*   TITLE: Median Chart Example 1                              */
/* PRODUCT: QC                                                  */
/*  SYSTEM: ALL                                                 */
/*    KEYS: Shewhart Charts, Median Charts,                     */
/*   PROCS: SHEWHART                                            */
/*    DATA:                                                     */
/*                                                              */
/*     REF: SAS/QC Software:  Usage and Reference, Version 6,   */
/*          First Edition, Volume 1 and Volume 2                */
/*                                                              */
/****************************************************************/

data Detergent;
   input Lot @;
   do i=1 to 5;
      input Weight @;
      output;
   end;
   drop i;
   datalines;
 1 17.39 26.93 19.34 22.56 24.49
 2 23.63 23.57 23.54 20.56 22.17
 3 24.35 24.58 23.79 26.20 21.55
 4 25.52 28.02 28.44 25.07 23.39
 5 23.25 21.76 29.80 23.09 23.70
 6 23.01 22.67 24.70 20.02 26.35
 7 23.86 24.19 24.61 26.05 24.18
 8 26.00 26.82 28.03 26.27 25.85
 9 21.58 22.31 25.03 20.86 26.94
10 22.64 21.05 22.66 29.26 25.02
11 26.38 27.50 23.91 26.80 22.53
12 23.01 23.71 25.26 20.21 22.38
13 23.15 23.53 22.98 21.62 26.99
14 26.83 23.14 24.73 24.57 28.09
15 26.15 26.13 20.57 25.86 24.70
16 25.81 23.22 23.99 23.91 27.57
17 25.53 22.87 25.22 24.30 20.29
18 24.88 24.15 25.29 29.02 24.46
19 22.32 25.96 29.54 25.92 23.44
20 25.63 26.83 20.95 24.80 27.25
21 21.68 21.11 26.07 25.17 27.63
22 26.72 27.05 24.90 30.08 25.22
23 31.58 22.41 23.67 23.47 24.90
24 28.06 23.44 24.92 24.64 27.42
25 21.10 22.34 24.96 26.50 24.51
26 23.80 24.03 24.75 24.82 27.21
27 25.10 26.09 27.21 24.28 22.45
28 25.53 22.79 26.26 25.85 25.64
;


ods graphics on;
title 'Median Chart for Detergent Box Weight';
proc shewhart data=Detergent;
   mchart Weight*Lot / ndecimal = 3
                       odstitle = title;
run;

title 'Median Chart for Detergent Box Weight';
proc shewhart data=Detergent;
   mchart Weight*Lot / ndecimal   = 3
                       odstitle   = title
                       medcentral = avgmean;
run;

title 'Median Chart for Detergent Box Weight';
proc shewhart data=Detergent;
   mchart Weight*Lot / ndecimal   = 3
                       odstitle   = title
                       medcentral = medmed;
run;

title 'Median Chart for Detergent Box Weight';
proc shewhart data=Detergent;
   mchart Weight*Lot / ndecimal = 3
                       mu0      = 25
                       odstitle = title
                       xsymbol  = mu0;
run;