Chapter Contents Previous Next
 XCHART Statement

## Saving Summary Statistics

 See CUSTWOS1 in the SAS/QC Sample Library

In this example, the CUSUM procedure is used to save summary statistics and cusums in an output data set. The summary statistics can subsequently be analyzed by the CUSUM procedure (as in the preceding example). The following statements read the raw measurements from the data set OIL (see "Creating a V-Mask Cusum Chart from Raw Data" ) and create a summary data set named OILHIST:

```   proc cusum data=oil;
xchart weight*hour /
nochart
outhistory = oilhist
mu0        = 8.100        /* target mean              */
sigma0     = 0.050        /* known standard deviation */
delta      = 1            /* shift to be detected     */
alpha      = 0.10         /* Type 1 error probability */
vaxis      = -5 to 3 ;
label weight = 'Cumulative Sum';
run;

proc print data=oilhist;
format weightx weights weightc 6.4 ;
run;
```

The OUTHISTORY= option names the SAS data set containing the summary information, and the NOCHART option suppresses the display of the charts (since the purpose here is simply to create an output data set). Figure 12.4 lists the data set OILHIST.

 Obs hour weightX weightS weightC weightN 1 1 8.0938 0.0596 -.2500 4 2 2 8.0925 0.0902 -.5500 4 3 3 8.1010 0.0763 -.5100 4 4 4 8.1198 0.0256 0.2800 4 5 5 8.1013 0.0265 0.3300 4 6 6 8.0800 0.0756 -.4700 4 7 7 8.1145 0.0372 0.1100 4 8 8 8.0830 0.0593 -.5700 4 9 9 8.0618 0.0057 -2.100 4 10 10 8.1023 0.0465 -2.010 4 11 11 8.1065 0.0405 -1.750 4 12 12 8.0993 0.0561 -1.780 4
Figure 12.4: Listing of the Data Set OILHIST

There are five variables in the data set.

• HOUR contains the subgroup index
• WEIGHTX contains the subgroup means
• WEIGHTS contains the subgroup standard deviations
• WEIGHTC contains the cumulative sums
• WEIGHTN contains the subgroup sample sizes

Note that the variables in the OUTHISTORY= data set are named by adding the suffix characters X, S, N, and C to the process WEIGHT specified in the XCHART statement. In other words, the variable naming convention for OUTHISTORY= data sets is the same as for HISTORY= data sets.