Creating Charts for Means and Ranges from Summary Data

[See SHWXR1 in the SAS/QC Sample Library]The previous example illustrates how you can create and charts based on raw data (process measurements). However, in many applications, the data are provided as subgroup means and ranges. This example illustrates how you can use the XRCHART statement with data of this type.

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

data Wafersum;
   input Batch DiameterX DiameterR;
   DiameterN = 5;
datalines;
 1  34.992  0.02
 2  34.994  0.03
 3  34.998  0.01
 4  34.998  0.02
 5  34.992  0.02
 6  34.996  0.01
 7  34.996  0.03
 8  34.992  0.02
 9  34.992  0.03
10  35.000  0.02
11  34.996  0.03
12  34.994  0.03
13  34.992  0.03
14  34.998  0.02
15  34.988  0.02
16  35.000  0.02
17  34.984  0.01
18  35.002  0.04
19  34.988  0.02
20  34.994  0.01
21  34.992  0.02
22  35.002  0.01
23  35.004  0.04
24  34.996  0.03
25  34.994  0.01
;

A partial listing of the data set Wafersum is shown in Figure 15.108.

Figure 15.108 Partial Listing of the Summary Data Set Wafersum
Summary Data Set for Wafer Diameters

Batch DiameterX DiameterR DiameterN
1 34.992 0.02 5
2 34.994 0.03 5
3 34.998 0.01 5
4 34.998 0.02 5
5 34.992 0.02 5

In this data set, there is exactly one observation for each subgroup (note that the subgroups are still indexed by Batch). The variable DiameterX contains the subgroup means, the variable DiameterR contains the subgroup ranges, and the variable DiameterN contains the subgroup sample sizes (these are all equal to five).

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

options nogstyle;
goptions ftext=swiss;
title 'Mean and Range Charts for Diameters';
symbol value = dot color = salmon;
proc shewhart history=Wafersum;
   xrchart Diameter*Batch / cframe   = bigb
                            cinfill  = ywh
                            cconnect = salmon
                            coutfill = yellow;
run;
options gstyle;

Note that Diameter is not the name of a SAS variable in the data set Wafersum but is, instead, the common prefix for the names of the three SAS variables DiameterX, DiameterR, and DiameterN. The suffix characters X, R, and N indicate mean, range, and sample size, respectively. Thus, you can specify three subgroup summary variables in the HISTORY= data set with a single name (Diameter), which is referred to as the process. The name Batch specified after the asterisk is the name of the subgroup-variable.

The NOGSTYLE system option causes the XRCHART statement to ignore ODS styles when producing traditional graphics. Instead, global statements (such as GOPTIONS, SYMBOL, and AXIS statements) and XRCHART options, specified after the slash (/) in the XRCHART statement, control the appearance of the charts. The GSTYLE system option restores the use of ODS styles for traditional graphics produced subsequently. A complete list of options is presented in the section Syntax: XRCHART Statement. For more information about the GOPTIONS and SYMBOL statements, see SAS/GRAPH: Reference. The resulting charts are shown in Figure 15.109.

Figure 15.109 and Charts from Summary Data (Traditional Graphics with NOGSTYLE)
X and R Charts from Summary Data (Traditional Graphics with NOGSTYLE)

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

  • subgroup variable

  • subgroup mean variable

  • subgroup range variable

  • subgroup sample size variable

Furthermore, the names of the subgroup mean, range, and sample size variables must begin with the process name specified in the XRCHART statement and end with the special suffix characters X, R, and N, respectively. If the names do not follow this convention, you can use the RENAME option to rename the variables for the duration of the SHEWHART procedure step. Suppose that, instead of the variables DiameterX, DiameterR, and DiameterN, the data set Wafersum contained summary variables named means, ranges, and sizes. The following statements would temporarily rename means, ranges, and sizes to DiameterX, DiameterR, and DiameterN, respectively:

proc shewhart
   history=Wafersum (rename=(means  = DiameterX
                             ranges = DiameterR
                             sizes  = DiameterN ));
   xrchart Diameter*Batch=;
run;

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

  • If raw data are read by 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 by using the HISTORY= option (as in this example), process is the common prefix for the names of the variables containing the summary statistics.

For more information, see HISTORY= Data Set.