#### Creating a V-Mask Cusum Chart from Subgroup Summary Data

See CUSTWOS1 in the SAS/QC Sample LibraryThe previous example illustrates how you can create a cusum chart using raw process measurements read from a DATA= data set. In many applications, however, the data are provided in summarized form as subgroup means. This example illustrates the use of the XCHART statement when the input data set is a HISTORY= data set.

The following data set provides the subgroup means, standard deviations, and sample sizes corresponding to the variable `Weight` in the data set `Oil` (see the section Creating a V-Mask Cusum Chart from Raw Data:

```data Oilstat;
label Hour = 'Hour';
input Hour WeightX WeightS WeightN;
datalines;
1  8.0938  0.0596  4
2  8.0925  0.0902  4
3  8.1010  0.0763  4
4  8.1198  0.0256  4
5  8.1013  0.0265  4
6  8.0800  0.0756  4
7  8.1145  0.0372  4
8  8.0830  0.0593  4
9  8.0618  0.0057  4
10  8.1023  0.0465  4
11  8.1065  0.0405  4
12  8.0993  0.0561  4
;
```

The data set `Oilstat` is listed in Figure 6.4.

Figure 6.4: Listing of the Data Set `Oilstat`

Obs Hour WeightX WeightS WeightN
1 1 8.0938 0.0596 4
2 2 8.0925 0.0902 4
3 3 8.1010 0.0763 4
4 4 8.1198 0.0256 4
5 5 8.1013 0.0265 4
6 6 8.0800 0.0756 4
7 7 8.1145 0.0372 4
8 8 8.0830 0.0593 4
9 9 8.0618 0.0057 4
10 10 8.1023 0.0465 4
11 11 8.1065 0.0405 4
12 12 8.0993 0.0561 4

Since the data set contains a subgroup variable, a mean variable, a standard deviation variable, and a sample size variable, it can be read as a HISTORY= data set. Note that the names `WeightX`, `WeightS`, and `WeightN` satisfy the naming conventions for summary variables since they begin with a common prefix (`Weight`) and end with the suffix letters X, S, and N.

The following statements create the cusum chart:

```title 'Cusum Chart for Average Weights of Cans';
proc cusum history=Oilstat;
xchart Weight*Hour /
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 WeightX = 'Cumulative Sum';
run;
```

Note that the process `Weight` specified in the XCHART statement is the prefix of the summary variable names in `Oilstat`. Also note that the vertical axis label is specified by associating a variable label with the subgroup mean variable (`WeightX`). The chart (not shown here) is identical to the one in Figure 6.2.

In general, a HISTORY= input data set used with the XRCHART statement must contain the following four variables:

• subgroup variable

• subgroup mean variable

• subgroup range variable

• subgroup sample size variable

Furthermore, the names of subgroup mean, standard deviation, and sample size variables must begin with the prefix process specified in the XRCHART statement and end with the special suffix characters X, S, and N, respectively.

Note that the interpretation of process depends on the input data set specified in the PROC CUSUM statement.

• If raw data are read using the DATA= option (as in the previous example), process is the name of the SAS variable containing the process measurements.

• If summary data are read using the HISTORY= option (as in this example), process is the common prefix for the names containing the summary statistics.