Note: See Mean (X-BAR) Chart Examples in the SAS/QC Sample Library.
The previous example illustrates how you can create 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 XCHART statement with data of this type.
The following data set (Parts
) provides the data from the preceding example in summarized form:
data Parts; input Sample PartgapX PartgapR; PartgapN=5; label PartgapX='Mean of Gap Width' Sample ='Sample Index'; datalines; 1 270 35 2 258 25 3 248 24 4 260 39 5 273 29 6 260 21 7 259 37 8 248 37 9 260 28 10 255 19 11 268 36 12 253 36 13 273 29 14 275 22 15 257 24 16 269 41 17 249 36 18 264 31 19 258 25 20 248 36 21 248 30 ;
A partial listing of Parts
is shown in FigureĀ 17.98. There is exactly one observation for each subgroup (note that the subgroups are still indexed by Sample
). The variable PartgapX
contains the subgroup means, the variable PartgapR
contains the subgroup ranges, and the variable PartgapN
contains the subgroup sample sizes (these are all 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 Chart for Gap Width'; proc shewhart history=Parts; xchart Partgap*Sample / cframe = vigb cinfill = vlib cconnect = red; run; options gstyle;
The NOGSTYLE system option causes ODS styles not to affect traditional graphics. Instead, the XCHART statement options control the appearance of the graph. The GSTYLE system option restores the use of ODS styles for traditional graphics produced subsequently. The resulting chart is shown in FigureĀ 17.99.
Note that Partgap
is not the name of a SAS variable in the data set but is, instead, the common prefix for the names of the three SAS variables PartgapX
, PartgapR
, and PartgapN
. The suffix characters X, R, and N indicate mean, range, and sample size, respectively. Thus, you can specify three subgroup summary variables in a HISTORY= data set with a single name (Partgap
), which is referred to as the process. The name Sample
specified after the asterisk is the name of the subgroup-variable.
In general, a HISTORY= input data set used with the XCHART statement must contain the following variables:
subgroup variable
subgroup mean variable
either a subgroup range variable or a subgroup standard deviation variable
subgroup sample size variable
Furthermore, the names of the subgroup mean, range (or standard deviation), and sample size variables must begin with the process name specified in the XCHART statement and end with the special suffix characters X, R (or 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).
If you specify the STDDEVIATIONS option in the XCHART statement, the HISTORY= data set must contain a subgroup standard deviation
variable; otherwise, the HISTORY= data set must contain a subgroup range variable. The STDDEVIATIONS option specifies that
the estimate of the process standard deviation is to be calculated from subgroup standard deviations rather than subgroup ranges. For example, in the following statements,
the data set Parts2
must contain a subgroup standard deviation variable named PartgapS
:
title 'Mean Chart for Gap Width'; proc shewhart history=Parts2; xchart Partgap*Sample='*' / stddeviations; run;
Options such as STDDEVIATIONS are specified after the slash (/) in the XCHART statement. A complete list of options is presented in the section Syntax: XCHART Statement.
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.
For more information, see HISTORY= Data Set.