Chapter Contents Previous Next
 XSCHART Statement

## Example 44.2: Computing Subgroup Summary Statistics

 See SHWXS3 in the SAS/QC Sample Library

You can use output data sets from a number of SAS procedures as input data sets for the SHEWHART procedure. In this example, the MEANS procedure is used to create a data set containing subgroup summary statistics, which can be read by the SHEWHART procedure as a HISTORY= data set. The following statements create an output data set named OILSUMM, which contains subgroup means, standard deviations, and sample sizes for the variable KWATTS in the data set TURBINE (see "Creating Charts for Means and Standard Deviations from Raw Data" ):

```   proc means data=turbine noprint;
var kwatts;
by day;
output out=oilsumm mean=means std=stds n=sizes;
run;
```

A listing of OILSUMM is shown in Output 44.2.1.

Output 44.2.1: The Data Set OILSUMM

 Summary Statistics for Power Output Data

 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

The variables MEANS, STDS, and SIZES do not follow the naming convention required for HISTORY= data sets (see "HISTORY= Data Set" ). The following statements temporarily rename these variables to KWATTSX, KWATTSS, and KWATTSN, respectively (the names required when the process KWATTS is specified in the XSCHART statement):

```   title 'Mean and Standard Deviation Charts for Power Output';
symbol v=dot;
proc shewhart
history=oilsumm (rename=(means  = kwattsx
stds   = kwattss
sizes  = kwattsn ));
xschart kwatts*day;
run;
```

The resulting charts are identical to the charts in Figure 44.2.

 Chapter Contents Previous Next Top