XSCHART Statement: SHEWHART Procedure

Example 17.42 Computing Subgroup Summary Statistics

See SHWXS3 in the SAS/QC Sample LibraryYou 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 Oilsummeans, 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=Oilsummeans mean=means std=stds n=sizes;
   run;

A listing of Oilsummeans is shown in Output 17.42.1.

Output 17.42.1: The Data Set Oilsummeans

Summary Statistics for Power Output Data

Day _TYPE_ _FREQ_ means stds sizes
04JUL 0 20 3487.40 220.260 20
05JUL 0 20 3471.65 210.427 20
06JUL 0 20 3488.30 147.025 20
07JUL 0 20 3434.20 157.637 20
08JUL 0 20 3475.80 258.949 20
09JUL 0 20 3518.10 211.566 20
10JUL 0 20 3492.65 193.779 20
11JUL 0 20 3496.40 212.024 20
12JUL 0 20 3398.50 199.201 20
13JUL 0 20 3456.05 173.455 20
14JUL 0 20 3493.60 187.465 20
15JUL 0 20 3563.30 205.472 20
16JUL 0 20 3519.05 173.676 20
17JUL 0 20 3474.20 200.576 20
18JUL 0 20 3443.60 222.084 20
19JUL 0 20 3586.35 185.724 20
20JUL 0 20 3486.45 223.474 20
21JUL 0 20 3492.90 145.267 20
22JUL 0 20 3432.80 190.994 20
23JUL 0 20 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';
proc shewhart
   history=Oilsummeans (rename=(means  = KWattsX
                                stds   = KWattsS
                                sizes  = KWattsN ));
   xschart KWatts*Day;
run;

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