Median Chart Examples
/****************************************************************/
/* S A S S A M P L E L I B R A R Y */
/* */
/* NAME: SHWMCHR */
/* TITLE: Median Chart Examples */
/* 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
;
title 'The Data Set DETERGENT';
proc print data=Detergent(obs=16) noobs;
run;
ods graphics off;
title 'Median Chart for Detergent Box Weight';
proc shewhart data=Detergent;
mchart Weight*Lot;
run;
data Detsum;
input Lot WeightM WeightR;
WeightN = 5;
datalines;
1 22.56 9.54
2 23.54 3.07
3 24.35 4.65
4 25.52 5.05
5 23.25 8.04
6 23.01 6.33
7 24.19 2.19
8 26.27 2.18
9 22.31 6.08
10 22.66 8.21
11 26.38 4.97
12 23.01 5.05
13 23.15 5.37
14 24.73 4.95
15 25.86 5.58
16 23.99 4.35
17 24.30 5.24
18 24.88 4.87
19 25.92 7.22
20 25.63 6.30
21 25.17 6.52
22 26.72 5.18
23 23.67 9.17
24 24.92 4.62
25 24.51 5.40
26 24.75 3.41
27 25.10 4.76
28 25.64 3.47
;
title 'Summary Data Set for Detergent Box Weights';
proc print data=Detsum noobs;
run;
options nogstyle;
goptions ftext='albany amt';
title 'Median Chart for Weights';
proc shewhart history=Detsum;
mchart Weight*Lot / cframe = viv
cinfill = vpav
cconnect = yellow;
run;
options gstyle;
proc shewhart data=Detergent;
mchart Weight*Lot / outhistory = Dethist
nochart;
run;
title 'Summary Data Set DETHIST for Detergent Box Weights';
proc print data=Dethist noobs;
run;
proc shewhart data=Detergent;
mchart Weight*Lot / outhistory = Dethist2
stddeviations
nochart;
run;
title 'Summary Data Set with Subgroup Standard Deviations';
proc print data=Dethist2 noobs;
run;
proc shewhart data=Detergent;
mchart Weight*Lot / outlimits=Detlim
nochart;
run;
title 'Control Limits for Detergent Box Weights';
proc print data=Detlim noobs;
run;
proc shewhart data=Detergent;
mchart Weight*Lot / outtable=Dtable
nochart;
run;
title 'Summary Statistics and Control Limit Information';
proc print data=Dtable noobs;
run;
data Detergent2;
input Lot @;
do i=1 to 5;
input Weight @;
output;
end;
drop i;
datalines;
29 16.66 27.49 18.87 22.53 24.72
30 23.74 23.67 23.64 20.26 22.09
31 24.56 24.82 23.92 26.67 21.38
32 25.89 28.73 29.21 25.38 23.47
33 23.32 21.61 30.75 23.13 23.82
34 23.04 22.65 24.96 19.64 26.84
35 24.01 24.38 24.86 26.50 24.37
36 26.43 27.36 28.74 26.74 26.27
37 21.41 22.24 25.34 20.59 27.51
38 22.62 20.81 22.64 30.15 25.32
39 26.86 28.14 24.06 27.35 22.49
40 23.03 23.83 25.59 19.85 22.33
41 23.19 23.63 23.00 21.46 27.57
42 27.38 23.18 24.99 24.81 28.82
43 26.60 26.58 20.26 26.27 24.96
44 26.22 23.28 24.15 24.06 28.23
45 25.90 22.88 25.55 24.50 19.95
46 16.66 27.49 18.87 22.53 24.72
47 23.74 23.67 23.64 20.26 22.09
48 24.56 24.82 23.92 26.67 21.38
49 25.89 28.73 29.21 25.38 23.47
50 23.32 21.61 30.75 23.13 23.82
;
ods graphics on;
title 'Median Chart for Weights';
proc shewhart data=Detergent2 limits=Detlim;
mchart Weight*Lot / odstitle=title markers;
run;