Chapter Contents Previous Next
 SCHART Statement

## Creating Standard Deviation Charts from Subgroup Summary Data

 See SHWSCHR in the SAS/QC Sample Library

The previous example illustrates how you can create s charts using raw data (process measurements). However, in many applications, the data are provided as subgroup summary statistics. This example illustrates how you can use the SCHART statement with data of this type.

The following data set (OILSUM) provides the data from the preceding example in summarized form:

```   data oilsum;
input day kwattsx kwattss kwattsn;
informat day date7. ;
format day date5. ;
label day   ='Date of Measurement';
datalines;
04JUL94 3487.40 220.260 20
05JUL94 3471.65 210.427 20
06JUL94 3488.30 147.025 20
07JUL94 3434.20 157.637 20
08JUL94 3475.80 258.949 20
09JUL94 3518.10 211.566 20
10JUL94 3492.65 193.779 20
11JUL94 3496.40 212.024 20
12JUL94 3398.50 199.201 20
13JUL94 3456.05 173.455 20
14JUL94 3493.60 187.465 20
15JUL94 3563.30 205.472 20
16JUL94 3519.05 173.676 20
17JUL94 3474.20 200.576 20
18JUL94 3443.60 222.084 20
19JUL94 3586.35 185.724 20
20JUL94 3486.45 223.474 20
21JUL94 3492.90 145.267 20
22JUL94 3432.80 190.994 20
23JUL94 3496.90 208.858 20
;
```

A listing of OILSUM is shown in Figure 40.3. There is exactly one observation for each subgroup (note that the subgroups are still indexed by DAY). The variable KWATTSX contains the subgroup means, the variable KWATTSS contains the subgroup standard deviations, and the variable KWATTSN contains the subgroup sample sizes (these are all 20).

 Summary Data Set for Power Outputs

 day kwattsx kwattss kwattsn 04JUL 3487.40 220.260 20 05JUL 3471.65 210.427 20 06JUL 3488.30 147.025 20 07JUL 3434.20 157.637 20 08JUL 3475.80 258.949 20 09JUL 3518.10 211.566 20 10JUL 3492.65 193.779 20 11JUL 3496.40 212.024 20 12JUL 3398.50 199.201 20 13JUL 3456.05 173.455 20 14JUL 3493.60 187.465 20 15JUL 3563.30 205.472 20 16JUL 3519.05 173.676 20 17JUL 3474.20 200.576 20 18JUL 3443.60 222.084 20 19JUL 3586.35 185.724 20 20JUL 3486.45 223.474 20 21JUL 3492.90 145.267 20 22JUL 3432.80 190.994 20 23JUL 3496.90 208.858 20
Figure 40.3: The Summary Data Set OILSUM

You can read this data set by specifying it as a HISTORY= data set in the PROC SHEWHART statement, as follows:

```   title 'Chart for Standard Deviations of Power Output';
proc shewhart history=oilsum lineprinter;
schart kwatts*day='*';
run;
```

The resulting s chart is shown in Figure 40.4. Since the LINEPRINTER option is specified in the PROC SHEWHART statement, line printer output is produced. The asterisk (*) specified in single quotes after the subgroup-variable indicates the character used to plot points. This character must follow an equal sign.

Note that KWATTS is not the name of a SAS variable in the data set OILSUM but is, instead, the common prefix for the names of the SAS variables KWATTSS and KWATTSN. The suffix characters S and N indicate standard deviation and sample size, respectively. Thus, you can specify two subgroup summary variables in the HISTORY= data set with a single name (KWATTS), which is referred to as the process. The name DAY, specified after the asterisk, is the name of the subgroup-variable.

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

• subgroup variable
• subgroup standard deviation variable
• subgroup sample size variable

Furthermore, the names of the subgroup standard deviation and sample size variables must begin with the process name specified in the SCHART statement and end with the special suffix characters S and N, respectively. If the names do not follow this convention, you can use the RENAME option in the PROC SHEWHART statement to rename the variables for the duration of the SHEWHART procedure step (see "Creating Charts for Means and Ranges from Summary Data" ).

 Chart for Standard Deviations of Power Output

 ``` 3 Sigma Limits For n=20: ---------------------------------------------------------- S 300 +==========================================================| UCL = 292.6 t | | d | * | 250 + ++ | D | + + | e |*++* + *+ +*+ +* * *| - v 200 +----+-----+------+*+---+*-------+*-----*+--++-++-+-----++-| S = 196.4 | + + ++ +*+ ++ ++ * + * | o | + + *+ * + ++ | f 150 + *++* * | | | k | | w 100 +==========================================================| LCL = 100.2 a | | t | | t 50 + | s +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ JUL JUL 04 06 08 10 12 14 16 18 20 22 Date of Measurement Subgroup Sizes: * n=20 ```
Figure 40.4: s Chart for Power Output Data

In summary, the interpretation of process depends on the input data set.

• 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 of the variables containing the summary statistics.