Chapter Contents Previous Next
 RCHART Statement

## Creating Range Charts from Summary Data

 See SHWRCHR in the SAS/QC Sample Library

The previous example illustrates how you can create R 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 RCHART statement with data of this type.

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

```   data disksum;
input lot timex timer;
timen=6;
datalines;
1  8.00833  0.16
2  8.02167  0.09
3  7.97833  0.07
4  8.00667  0.10
5  8.01833  0.16
6  8.00667  0.12
7  7.98500  0.15
8  8.03000  0.11
9  8.03000  0.15
10  7.99167  0.10
11  7.98833  0.10
12  7.98500  0.09
13  7.98833  0.13
14  8.00167  0.10
15  7.98333  0.13
16  8.01833  0.09
17  8.00833  0.11
18  7.98667  0.20
19  7.98667  0.18
20  8.01500  0.10
21  7.99000  0.14
22  8.01833  0.20
23  8.00833  0.11
24  7.98500  0.06
25  8.03667  0.15
;
```

A listing of DISKSUM is shown in Figure 39.3. There is exactly one observation for each subgroup (note that the subgroups are still indexed by LOT). The variable TIMEX contains the subgroup means, the variable TIMER contains the subgroup ranges, and the variable TIMEN contains the subgroup sample sizes (these are all six).

 The Summary Data Set of Disk Drive Test Times

 lot timex timer timen 1 8.00833 0.16 6 2 8.02167 0.09 6 3 7.97833 0.07 6 4 8.00667 0.10 6 5 8.01833 0.16 6 6 8.00667 0.12 6 7 7.98500 0.15 6 8 8.03000 0.11 6 9 8.03000 0.15 6 10 7.99167 0.10 6 11 7.98833 0.10 6 12 7.98500 0.09 6 13 7.98833 0.13 6 14 8.00167 0.10 6 15 7.98333 0.13 6 16 8.01833 0.09 6 17 8.00833 0.11 6 18 7.98667 0.20 6 19 7.98667 0.18 6 20 8.01500 0.10 6 21 7.99000 0.14 6 22 8.01833 0.20 6 23 8.00833 0.11 6 24 7.98500 0.06 6 25 8.03667 0.15 6
Figure 39.3: The Summary Data Set DISKSUM

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

```   title 'Range Chart for Disk Drive Test Times';
proc shewhart history=disksum lineprinter;
rchart time*lot='X';
run;
```

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

Note that TIME is not the name of a SAS variable in the data set DISKSUM but is, instead, the common prefix for the names of the SAS variables TIMER and TIMEN. The suffix characters R and N indicate range and sample size, respectively. Thus, you can specify two subgroup summary variables in the HISTORY= data set with a single name (TIME), which is referred to as the process. The name LOT specified after the asterisk is the name of the subgroup-variable.

 Range Chart for Disk Drive Test Times

 ``` 3 Sigma Limits For n=6: ----------------------------------------------------- 0.30 + | | | | | R 0.25 +=====================================================| UCL = .248 a | | n | | g 0.20 + X+ X | e | + X + | | X X + + + + | o 0.15 + + ++ X X + + + + X | f | + + + + + + + X X + + X + + | - |---+-----+--X---X--+-----+-+-+-+--X-----++----X--+---| R = .124 t 0.10 + + X X+X+ + X + + X + + | i | X+ + X X ++ | m | X X | e 0.05 + | | | | | 0 +=====================================================| LCL = 0 +---+---+---+---+---+---+---+---+---+---+---+---+---+ 0 2 4 6 8 10 12 14 16 18 20 22 24 26 Subgroup Index (lot) Subgroup Sizes: X n=6 ```
Figure 39.4: R Chart from the Summary Data Set DISKSUM

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

• subgroup variable
• subgroup range variable
• subgroup sample size variable

Furthermore, the names of the subgroup range and sample size variables must begin with the process name specified in the RCHART statement and end with the special suffix characters R and N, respectively. If the names do not follow this convention, you can use the RENAME option.

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.