Chapter Contents Previous Next
 MCHART Statement

Saving Summary Statistics

 See SHWMCHR in the SAS/QC Sample Library

In this example, the MCHART statement is used to create a summary data set that can be read later by the SHEWHART procedure (as in the preceding example). The following statements read measurements from the data set DETERGNT and create a summary data set named DETHIST:

```   title 'Summary Data Set DETHIST for Detergent Box Weights';
proc shewhart data=detergnt;
mchart weight*lot / outhistory = dethist
nochart;
run;
```

The OUTHISTORY= option names the output data set, and the NOCHART option suppresses the display of the chart, which would be identical to the chart in Figure 35.2. Figure 35.5 contains a listing of DETHIST.

 Summary Data Set DETHIST for Detergent Box Weights

 lot weightM weightR weightN 1 22.56 9.54 5 2 23.54 3.07 5 3 24.35 4.65 5 4 25.52 5.05 5 5 23.25 8.04 5 6 23.01 6.33 5 7 24.19 2.19 5 8 26.27 2.18 5 9 22.31 6.08 5 10 22.66 8.21 5 11 26.38 4.97 5 12 23.01 5.05 5 13 23.15 5.37 5 14 24.73 4.95 5 15 25.86 5.58 5 16 23.99 4.35 5 17 24.30 5.24 5 18 24.88 4.87 5 19 25.92 7.22 5 20 25.63 6.30 5 21 25.17 6.52 5 22 26.72 5.18 5 23 23.67 9.17 5 24 24.92 4.62 5 25 24.51 5.40 5 26 24.75 3.41 5 27 25.10 4.76 5 28 25.64 3.47 5
Figure 35.5: The Summary Data Set DETHIST

There are four variables in the data set DETHIST.

• LOT contains the subgroup index.
• WEIGHTM contains the subgroup medians.
• WEIGHTR contains the subgroup ranges.
• WEIGHTN contains the subgroup sample sizes.

Note that the summary statistic variables are named by adding the suffix characters M, R, and N to the process WEIGHT specified in the MCHART statement. In other words, the variable naming convention for OUTHISTORY= data sets is the same as that for HISTORY= data sets.

If you specify the STDDEVIATIONS option, the OUTHISTORY= data set includes a subgroup standard deviation variable instead of a subgroup range variable, as demonstrated by the following statements:

```   title 'Summary Data Set with Subgroup Standard Deviations';
proc shewhart data=detergnt;
mchart weight*lot / outhistory = dethist2
stddeviations
nochart;
run;
```

Figure 35.6 contains a listing of DETHIST2.

 Summary Data Set with Subgroup Standard Deviations

 lot weightM weightS weightN 1 22.56 3.84205 5 2 23.54 1.34050 5 3 24.35 1.68087 5 4 25.52 2.11558 5 5 23.25 3.14747 5 6 23.01 2.37115 5 7 24.19 0.86491 5 8 26.27 0.88382 5 9 22.31 2.55563 5 10 22.66 3.20064 5 11 26.38 2.10858 5 12 23.01 1.85360 5 13 23.15 1.99936 5 14 24.73 1.96853 5 15 25.86 2.37425 5 16 23.99 1.77395 5 17 24.30 2.14006 5 18 24.88 1.98148 5 19 25.92 2.78591 5 20 25.63 2.51040 5 21 25.17 2.82905 5 22 26.72 2.05752 5 23 23.67 3.67124 5 24 24.92 1.96007 5 25 24.51 2.15219 5 26 24.75 1.35365 5 27 25.10 1.80968 5 28 25.64 1.38345 5
Figure 35.6: The Summary Data Set DETHIST2

The variable WEIGHTS, which contains the subgroup standard deviations, is named by adding the suffix character S to the process WEIGHT.