Chapter Contents |
Previous |
Next |
XCHART Statement |
See CUSUPLO in the SAS/QC Sample Library |
This example illustrates how to combine upper and lower one-sided cusum charts for means in the same display. As in the preceding example, OUTTABLE= data sets are created with the CUSUM procedure, and the display is created with the SHEWHART procedure.
The following statements analyze the variable WEIGHT in the data set OIL (see "Creating a V-Mask Cusum Chart from Raw Data" ). The first step is to compute and save upper and lower one-sided cusums for shifts of one standard error in the positive and negative directions.
proc cusum data=oil; xchart weight*hour / nochart 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 outtable = tabupper ( drop = _subx_ _subs_ _exlim_ rename = ( _cusum_ = _subx_ _h_ = _uclx_ ) ) ; xchart weight*hour / nochart 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 outtable = tablower ( drop = _var_ _subn_ _subx_ _subs_ _exlim_ rename = ( _cusum_ = _subs_ _h_ = _ucls_ ) ) ; run;
Next, the OUTTABLE= data sets are merged.
data tabboth; merge tabupper tablower; by hour; _mean_ = _uclx_ * 0.5; _s_ = _ucls_ * 0.5; _lclx_ = 0.0; _lcls_ = 0.0; run;
The variables _LCLX_ and _UCLX_ are assigned lower limits of zero for the cusums, and the variables _MEAN_ and _S_ are assigned dummy values. Now, TABBOTH 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").
The final step is to read TABBOTH as a TABLE= data set with the SHEWHART procedure.
title 'Upper and Lower Cusums'; symbol v=dot c=salmon; proc shewhart table=tabboth; xschart weight * hour / nolimitslegend ucllabel = 'h=3.0' ucllabel2 = 'h=3.0' ypct1 = 50 vref = 1 2 vref2 = 1 2 lvref = 2 noctl2 split = '/' nolegend noctl cframe = bigb cinfill = ywh cconnect = salmon coutfill = yellow; label _subx_ = 'Upper Sum/Lower Sum'; run;The combined display is shown in Output 12.2.1. There is no evidence of a shift in either direction. Output 12.2.1: Upper and Lower One-Sided Cusum Charts
Chapter Contents |
Previous |
Next |
Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.