Chapter Contents |
Previous |
Next |
XCHART Statement |
See CUSXS in the SAS/QC Sample Library |
When you are working with subgrouped data, it can be helpful to accompany a cusum chart for means with a Shewhart s chart for monitoring the variability of the process. This example creates this combination for the variable WEIGHT in the data set OIL (see "Creating a V-Mask Cusum Chart from Raw Data" ).
The first step is to create a one-sided cusum chart for means that detects a shift of one standard error ()below the target mean.
proc cusum data=oil; xchart weight*hour / nochart /* suppress display */ mu0 = 8.100 /* target mean */ sigma0 = 0.050 /* known standard deviation */ delta = -1 /* shift to be detected */ h = 3 /* decision interval */ k = 0.5 /* reference value */ scheme=onesided /* one-sided scheme */ outtable = tabcusum /* save the results */ ( drop = _var_ _subn_ _subx_ _exlim_ rename = ( _cusum_ = _subx_ _h_ = _uclx_ ) ) ; run;
The results are saved in an OUTTABLE= data set named TABCUSUM. The cusum variable (_CUSUM_) and the decision interval variable (_H_) are renamed to _SUBX_ and _LCLX_ so that they can later be read by the SHEWHART procedure.
The next step is to construct a Shewhart and s chart for WEIGHT and save the results in a data set named TABXSCHT.
proc shewhart data=oil; xschart weight*hour / nochart /* suppress display */ outtable = tabxscht /* save the results */ ( drop = _subx_ _uclx_ ); run;
Note that the variables _SUBX_ and _UCLX_ are dropped from TABXSCHT.
The third step is to merge the data sets TABCUSUM and TABXSCHT.
data taball; merge tabxscht tabcusum; by hour; _mean_ = _uclx_ * 0.5; _lclx_ = 0.0; run; proc print; run;The variable _LCLX_ is assigned the role of the lower limit for the cusums, and the variable _MEAN_ is assigned a dummy value. Now, TABALL, which is listed in Output 12.1.1, has the structure required for a TABLE= data set used with the XSCHART statement in the SHEWHART procedure (see "TABLE= Data Set" in Chapter 44, "XSCHART Statement"). Output 12.1.1: Listing of the Data Set TABALL
title 'Cusum Chart for Mean and s chart'; symbol v=dot c=salmon; proc shewhart table=taball; xschart weight * hour / ucllabel = 'h=3.0' nolimitslegend noctl split = '/' nolegend cinfill = ywh coutfill = yellow cconnect = salmon cframe = bigb; label _subx_ = 'Lower Cusum/Std Dev'; run;
The central line for the primary (cusum) chart is suppressed with the NOCTL option, and the default 3 Limits legend is suppressed with the NOLIMITLEGEND option. The charts are shown in Output 12.1.2.
Output 12.1.2: Combined Cusum Chart and s ChartThe process variability is stable, and there is no signal of a downward shift in the process mean.
Chapter Contents |
Previous |
Next |
Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.