XCHART Statement: CUSUM Procedure

Saving Summary Statistics

See CUSTWOS1 in the SAS/QC Sample LibraryIn 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:

title 'Cusum Chart for Average Weights of Cans';
proc cusum data=Oil;
   xchart Weight*Hour /
      nochart
      outhistory = Oilhist
      mu0        = 8.100        /* Target mean for process  */
      sigma0     = 0.050        /* Known standard deviation */
      delta      = 1            /* Shift to be detected     */
      alpha      = 0.10         /* Type I error probability */
      vaxis      = -5 to 3 ;
   label Weight = 'Cumulative Sum';
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 6.5 lists the data set Oilhist.

Figure 6.5: Listing of the Data Set Oilhist

Cusum Chart for Average Weights of Cans

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


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.

For more information, see OUTHISTORY= Data Set.