Top Banner
Chapter 12 XCHART Statement Chapter Table of Contents OVERVIEW ................................... 361 GETTING STARTED .............................. 362 Creating a V-Mask Cusum Chart from Raw Data ............... 362 Creating a V-Mask Cusum Chart from Subgroup Summary Data ....... 365 Saving Summary Statistics ........................... 367 Creating a One-Sided Cusum Chart with a Decision Interval ......... 368 Saving Cusum Scheme Parameters ....................... 371 Reading Cusum Scheme Parameters ...................... 373 SYNTAX ..................................... 375 Summary of Options .............................. 376 Dictionary of Special Options ......................... 385 DETAILS ..................................... 391 Basic Notation for Cusum Charts ........................ 391 Formulas for Cumulative Sums ......................... 392 Defining the Decision Interval for a One-Sided Cusum Scheme ........ 394 Defining the V-Mask for a Two-Sided Cusum Scheme ............. 395 Designing a Cusum Scheme .......................... 397 Cusum Charts Compared with Shewhart Charts ................ 401 Methods for Estimating the Standard Deviation ................ 401 Output Data Sets ................................ 404 ODS Tables ................................... 406 Input Data Sets ................................. 406 Missing Values ................................. 409 EXAMPLES ................................... 410 Example 12.1 Cusum and Standard Deviation Charts ............. 410 Example 12.2 Upper and Lower One-Sided Cusum Charts .......... 413 Example 12.3 Combined Shewhart–Cusum Scheme .............. 414 359
59

XCHART Statement

Mar 17, 2022

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: XCHART Statement

Chapter 12XCHART Statement

Chapter Table of Contents

OVERVIEW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361

GETTING STARTED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362Creating a V-Mask Cusum Chart from Raw Data . . . . . . . . . . . . . . . 362Creating a V-Mask Cusum Chart from Subgroup Summary Data . .. . . . . 365Saving Summary Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . 367Creating a One-Sided Cusum Chart with a Decision Interval . . . . . . . . . 368Saving Cusum Scheme Parameters . . . . . . . . . . . . . . . . . . . . . . . 371Reading Cusum Scheme Parameters . . . . . . . . . . . . . . . . . . . . . . 373

SYNTAX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375Summary of Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376Dictionary of Special Options . . . . . . . . . . . . . . . . . . . . . . . . . 385

DETAILS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391Basic Notation for Cusum Charts . . . . . . . . . . . . . . . . . . . . . . . . 391Formulas for Cumulative Sums . . . . . . . . . . . . . . . . . . . . . . . . . 392Defining the Decision Interval for a One-Sided Cusum Scheme . . . . . . . . 394Defining the V-Mask for a Two-Sided Cusum Scheme . . . . . . . . . . . . . 395Designing a Cusum Scheme . . . . . . . . . . . . . . . . . . . . . . . . . . 397Cusum Charts Compared with Shewhart Charts . . . . . . . . . . . . . . . . 401Methods for Estimating the Standard Deviation. . . . . . . . . . . . . . . . 401Output Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404ODS Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406Input Data Sets. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406Missing Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409

EXAMPLES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410Example 12.1 Cusum and Standard Deviation Charts . . . . . . . . . . . . . 410Example 12.2 Upper and Lower One-Sided Cusum Charts . . . . . . . . . . 413Example 12.3 Combined Shewhart–Cusum Scheme . . . . . . . . . . . . . . 414

359

Page 2: XCHART Statement

Part 2. The CAPABILITY Procedure

SAS OnlineDoc: Version 8360

Page 3: XCHART Statement

Chapter 12XCHART Statement

Overview

The XCHART statement creates cumulative sum control charts from subgroup meansor individual measurements. You can create these charts for one-sided cusum (deci-sion interval) schemes or for two-sided (V-mask) schemes. A one-sided scheme isdesigned to detect either a positive or a negative shift from the target mean, and atwo-sided scheme is designed to detect positive and negative shifts from the targetmean.

You can use options in the XCHART statement to

� specify parameters for a decision interval or V-mask

� specify the shift� to be detected

� specify the target mean�0

� specify a known (standard) value�0 for the process standard deviation or esti-mate the standard deviation from the data using various methods

� tabulate the information displayed on the chart

� save the information displayed on the chart in an output data set

� read parameters for the cusum scheme from a data set

� display a secondary chart that plots a time trend that has been removed fromthe data

� add block legends and special symbol markers to reveal stratification in processdata

� superimpose stars at each point to represent related multivariate factors

� display vertical and horizontal reference lines

� modify the axis values and labels

� modify the chart layout and appearance

361

Page 4: XCHART Statement

Part 2. The CAPABILITY Procedure

Getting Started

This section introduces the XCHART statement with simple examples that illustratethe most commonly used options. Complete syntax for the XCHART statement ispresented in the “Syntax” section on page 375, and advanced examples are given inthe “Examples” section on page 410.

Creating a V-Mask Cusum Chart from Raw Data

A machine fills eight-ounce cans of two-cycle engine oil additive. The filling processSee CUSTWOS1in the SAS/QCSample Library

is believed to be in statistical control, and the process is set so that the average weightof a filled can is�0 = 8:100 ounces. Previous analysis shows that the standarddeviation of fill weights is�0 = 0:050 ounces. A two-sided cusum chart is usedto detect shifts of at least one standard deviation in either the positive or negativedirection from the target mean of 8.100 ounces.

Subgroup samples of four cans are selected every hour for twelve hours. The cansare weighed, and their weights are saved in a SAS data set named OIL.

data oil;label hour = ’Hour’;input hour @;do i=1 to 4;

input weight @;output;end;

drop i;datalines;

1 8.024 8.135 8.151 8.0652 7.971 8.165 8.077 8.1573 8.125 8.031 8.198 8.0504 8.123 8.107 8.154 8.0955 8.068 8.093 8.116 8.1286 8.177 8.011 8.102 8.0307 8.129 8.060 8.125 8.1448 8.072 8.010 8.097 8.1539 8.066 8.067 8.055 8.059

10 8.089 8.064 8.170 8.08611 8.058 8.098 8.114 8.15612 8.147 8.116 8.116 8.018;

proc print noobs;run;

The data set OIL is partially listed in Figure 12.1.

SAS OnlineDoc: Version 8362

Page 5: XCHART Statement

Chapter 12. Getting Started

hour weight

1 8.0241 8.1351 8.1511 8.0652 7.9712 8.1652 8.0772 8.1573 8.1253 8.0313 8.1983 8.0504 8.123. .. .. .

12 8.018

Figure 12.1. Partial Listing of the Data Set OIL

Each observation contains one value of WEIGHT along with its associated value ofHOUR, and the values of HOUR are in increasing order. The CUSUM procedureassumes that DATA= input data sets are sorted in this “strung-out” form.

The following statements request a two-sided cusum chart with a V-mask for theaverage weights:

symbol v=dot;title ’Cusum Chart for Average Weights of Cans’;proc cusum data=oil;

xchart weight*hour /mu0 = 8.100 /* target mean */sigma0 = 0.050 /* known standard deviation */delta = 1 /* shift to be detected */alpha = 0.10 /* Type 1 error probability */vaxis = -5 to 3 ;

label weight=’Cumulative Sum’;run;

The CUSUM procedure is invoked with the PROC CUSUM statement. The DATA=option in the PROC CUSUM statement specifies that the SAS data set OIL is to beread. The variables to be analyzed are specified in the XCHART statement. The pro-cess measurement variable (WEIGHT) is specified before the asterisk (this variableis referred to more generally as aprocess). The time variable (HOUR) is specifiedafter the asterisk (this variable is referred to more generally as asubgroup-variablebecause it determines how the measurements are classified into rational subgroups).

The option ALPHA=0.10 specifies the probability of a Type 1 error for the cusumscheme (the probability of detecting a shift when none occurs).

The cusum chart is shown in Figure 12.2.

363SAS OnlineDoc: Version 8

Page 6: XCHART Statement

Part 2. The CAPABILITY Procedure

Figure 12.2. Two-Sided Cusum Chart with V-Mask

The cusumS1 plotted at HOUR=1 is simply the standardized deviation of the firstsubgroup mean from the target mean.

S1 =8:09375 � 8:100

0:050=p4

= �0:250

The cusumS2 plotted at HOUR=2 isS1 plus the standardized deviation of the secondsubgroup mean from the target mean.

S2 = S1 +8:0925 � 8:100

0:050=p4

= �0:550

In general, the cusum plotted at HOUR=t is St�1 plus the standardized deviation ofthetth subgroup mean from the target mean.

St = St�1 +�Xt � �0�0=

pn

For further details, see “Two-Sided Cusum Schemes” on page 393.

You can interpret the chart by comparing the points with the V-mask whose rightedge is centered at the most recent point (HOUR=12). Since none of the pointscross the arms of the V-mask, there is no evidence that a shift has occurred, and thefluctuations in the cusums can be attributed to chance variation. In general, crossingthe lower arm is evidence of an increase in the process mean, whereas crossing theupper arm is evidence of a decrease in the mean.

SAS OnlineDoc: Version 8364

Page 7: XCHART Statement

Chapter 12. Getting Started

Creating a V-Mask Cusum Chart from Subgroup SummaryData

The previous example illustrates how you can create a cusum chart using raw processSee CUSTWOS1in the SAS/QCSample Library

measurements read from a DATA= data set. In many applications, however, the dataare provided insummarized formas subgroup means. This example illustrates theuse of the XCHART statement when the input data set is a HISTORY= data set.

The following data set provides the subgroup means, standard deviations, and samplesizes corresponding to the variable WEIGHT in the data set OIL (see page 362):

data oilstat;input hour weightx weights weightn;datalines;

1 8.0938 0.0596 42 8.0925 0.0902 43 8.1010 0.0763 44 8.1198 0.0256 45 8.1013 0.0265 46 8.0800 0.0756 47 8.1145 0.0372 48 8.0830 0.0593 49 8.0618 0.0057 4

10 8.1023 0.0465 411 8.1065 0.0405 412 8.0993 0.0561 4;proc print;

run;

The data set OILSTAT is listed in Figure 12.3.

Obs hour weightx weights weightn

1 1 8.0938 0.0596 42 2 8.0925 0.0902 43 3 8.1010 0.0763 44 4 8.1198 0.0256 45 5 8.1013 0.0265 46 6 8.0800 0.0756 47 7 8.1145 0.0372 48 8 8.0830 0.0593 49 9 8.0618 0.0057 4

10 10 8.1023 0.0465 411 11 8.1065 0.0405 412 12 8.0993 0.0561 4

Figure 12.3. Listing of the Data Set OILSTAT

Since the data set contains a subgroup variable, a mean variable, a standard deviationvariable, and a sample size variable, it can be read as a HISTORY= data set. Note thatthe names WEIGHTX, WEIGHTS, and WEIGHTN satisfy the naming conventionsfor summary variables since they begin with a common prefix (WEIGHT) and endwith the suffix lettersX, S, andN.

365SAS OnlineDoc: Version 8

Page 8: XCHART Statement

Part 2. The CAPABILITY Procedure

The following statements create the cusum chart:

title ’Cusum Chart for Average Weights of Cans’;

proc cusum history=oilstat;xchart weight*hour /

mu0 = 8.100 /* target mean */sigma0 = 0.050 /* known standard deviation */delta = 1 /* shift to be detected */alpha = 0.10 /* Type 1 error probability */vaxis = -5 to 3 ;

label weightx = ’Cumulative Sum’;run;

Note that theprocessWEIGHT specified in the XCHART statement is the prefixof the summary variable names in PARTS. Also note that the vertical axis label isspecified by associating a variable label with the subgroup mean variable (PART-GAPX). The horizontal axis label is specified by associating a variable label withthesubgroup-variable(HOUR). The chart (not shown here) is identical to the one inFigure 12.2.

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

� subgroup variable� subgroup mean variable� subgroup range variable� subgroup sample size variable

Furthermore, the names of subgroup mean, standard deviation, and sample size vari-ables must begin with the prefixprocessspecified in the XRCHART statement andend with the special suffix charactersX, S, andN, respectively.

Note that the interpretation ofprocessdepends on the input data set specified in thePROC CUSUM statement.

� If raw data are read using the DATA= option (as in the previous example),processis the name of the SAS variable containing the process measurements.

� If summary data are read using the HISTORY= option (as in this example),processis the common prefix for the names containing the summary statistics.

For more information, see “DATA= Data Set” on page 406 and “HISTORY= DataSet” on page 408.

SAS OnlineDoc: Version 8366

Page 9: XCHART Statement

Chapter 12. Getting Started

Saving Summary Statistics

In this example, the CUSUM procedure is used to save summary statistics andSee CUSTWOS1in the SAS/QCSample Library

cusums in an output data set. The summary statistics can subsequently be analyzed bythe CUSUM procedure (as in the preceding example). The following statements readthe raw measurements from the data set OIL (see page 362) and create a summarydata set named OILHIST:

proc cusum data=oil;xchart weight*hour /

nochartouthistory = oilhistmu0 = 8.100 /* target mean */sigma0 = 0.050 /* known standard deviation */delta = 1 /* shift to be detected */alpha = 0.10 /* Type 1 error probability */vaxis = -5 to 3 ;

label weight = ’Cumulative Sum’;run;

proc print data=oilhist;format weightx weights weightc 6.4 ;

run;

The OUTHISTORY= option names the SAS data set containing the summary infor-mation, and the NOCHART option suppresses the display of the charts (since thepurpose here is simply to create an output data set). Figure 12.4 lists the data setOILHIST.

Obs hour weightX weightS weightC weightN

1 1 8.0938 0.0596 -.2500 42 2 8.0925 0.0902 -.5500 43 3 8.1010 0.0763 -.5100 44 4 8.1198 0.0256 0.2800 45 5 8.1013 0.0265 0.3300 46 6 8.0800 0.0756 -.4700 47 7 8.1145 0.0372 0.1100 48 8 8.0830 0.0593 -.5700 49 9 8.0618 0.0057 -2.100 4

10 10 8.1023 0.0465 -2.010 411 11 8.1065 0.0405 -1.750 412 12 8.0993 0.0561 -1.780 4

Figure 12.4. Listing of the Data Set OILHIST

There are five variables in the data set.

� HOUR contains the subgroup index� WEIGHTX contains the subgroup means� WEIGHTS contains the subgroup standard deviations� WEIGHTC contains the cumulative sums� WEIGHTN contains the subgroup sample sizes

367SAS OnlineDoc: Version 8

Page 10: XCHART Statement

Part 2. The CAPABILITY Procedure

Note that the variables in the OUTHISTORY= data set are named by adding thesuffix charactersX, S, N, andC to theprocessWEIGHT specified in the XCHARTstatement. In other words, the variable naming convention for OUTHISTORY= datasets is the same as for HISTORY= data sets.

For more information, see “OUTHISTORY= Data Set” on page 405.

Creating a One-Sided Cusum Chart with a Decision Interval

An alternative to the V-mask cusum chart is the one-sided cusum chart with a de-See CUSONES1in the SAS/QCSample Library

cision interval, which is sometimes referred to as the “computational form of thecusum chart.” This example illustrates how you can create a one-sided cusum chartfor individual measurements.

A can of oil is selected every hour for fifteen hours. The cans are weighed, and theirweights are saved in a SAS data set named CANS:�

data cans;length comment $16;label hour = ’Hour’;input hour weight comment $16. ;datalines;

1 8.0242 7.9713 8.1254 8.1235 8.0686 8.177 Pump Adjusted7 8.229 Pump Adjusted8 8.0729 8.066

10 8.08911 8.05812 8.14713 8.14114 8.04715 8.125;

Suppose the problem is to detect apositiveshift in the process mean of one standarddeviation (� = 1) from the target of 8.100 ounces. Furthermore, suppose that

� a known value�0 = 0:050 is available for the process standard deviation� an in-control average run length (ARL) of approximately 100 is required� an ARL of approximately five is appropriate for detecting the shift

Table 12.18 on page 399 indicates that these ARLs can be achieved with the decisionintervalh = 3 and the reference valuek = 0:5. The following statements use theseparameters to create the chart and tabulate the cusum scheme:

�This data set is used by later examples in this chapter.

SAS OnlineDoc: Version 8368

Page 11: XCHART Statement

Chapter 12. Getting Started

title ’One-Sided Cusum Analysis’;proc cusum data=cans;

xchart weight*hour /mu0 = 8.100 /* target mean for process */sigma0 = 0.050 /* known standard deviation */delta = 1 /* shift to be detected */h = 3 /* cusum parameter h */k = 0.5 /* cusum parameter k */scheme = onesided /* one-sided decision interval */tableall; /* table */

label weight = ’Cusum of Weight’;run;

The chart is shown in Figure 12.5.

Figure 12.5. One-Sided Cusum Chart with Decision Interval

The cusum plotted at HOUR=t is

St = max(0; St�1 + (zt � k))

whereS0 = 0, andzt is the standardized deviation of thetth measurement from thetarget.

zt =xt � �0�0

The cusumSt is referred to as anupper cumulative sum. A shift is signaled at the sev-enth hour sinceS7 exceedsh. For further details, see “One-Sided Cusum Schemes”on page 392.

369SAS OnlineDoc: Version 8

Page 12: XCHART Statement

Part 2. The CAPABILITY Procedure

The option TABLEALL requests the tables shown in Figure 12.6, Figure 12.7, andFigure 12.8. The table in Figure 12.6 summarizes the cusum scheme, and it confirmsthat an in-control ARL of 117.6 and an ARL of 6.4 at� = 1 are achieved with thespecifiedh andk.

One-Sided Cusum Analysis

Cusum Parameters

Process Variable weight (Cusum of Weight)Subgroup Variable hour (Hour)Scheme One-SidedTarget Mean (Mu0) 8.1Sigma0 0.05Delta 1Nominal Sample Size 1h 3k 0.5Average Run Length (Delta) 6.40390895Average Run Length (0) 117.595692

Figure 12.6. Summary Table

The table in Figure 12.7 tabulates the information displayed in Figure 12.5.

Cumulative Sum Chart Summary for weight

Subgroup DecisionSample Individual Decision Interval

hour Size Value Cusum Interval Exceeded

1 1 8.0240000 0.0000000 3.00002 1 7.9710000 0.0000000 3.00003 1 8.1250000 0.0000000 3.00004 1 8.1230000 0.0000000 3.00005 1 8.0680000 0.0000000 3.00006 1 8.1770000 1.0400000 3.00007 1 8.2290000 3.1200000 3.0000 Upper8 1 8.0720000 2.0600000 3.00009 1 8.0660000 0.8800000 3.0000

10 1 8.0890000 0.1600000 3.000011 1 8.0580000 0.0000000 3.000012 1 8.1470000 0.4400000 3.000013 1 8.1410000 0.7600000 3.000014 1 8.0470000 0.0000000 3.000015 1 8.1250000 0.0000000 3.0000

Figure 12.7. Tabulation of One-Sided Chart

The table in Figure 12.8 presents the computational form of the cusum scheme de-scribed by Lucas (1976).

SAS OnlineDoc: Version 8370

Page 13: XCHART Statement

Chapter 12. Getting Started

Computational Cumulative Sum for weight

Subgroup Number ofSample Individual Upper Consecutive

hour Size Value Cusum Upper Sums > 0

1 1 8.0240000 0.0000000 02 1 7.9710000 0.0000000 03 1 8.1250000 0.0000000 04 1 8.1230000 0.0000000 05 1 8.0680000 0.0000000 06 1 8.1770000 1.0400000 17 1 8.2290000 3.1200000 28 1 8.0720000 2.0600000 39 1 8.0660000 0.8800000 4

10 1 8.0890000 0.1600000 511 1 8.0580000 0.0000000 012 1 8.1470000 0.4400000 113 1 8.1410000 0.7600000 214 1 8.0470000 0.0000000 015 1 8.1250000 0.0000000 0

Figure 12.8. Computational Form of Cusum Scheme

Following the method of Lucas (1976), the process average at the out-of-control point(HOUR=7) can be estimated as

�0 + �0(N7k + S7)=(N7

pn)

= 8:10 + 0:05(2(0:5) + 3:12)=2

= 8:203 ounces

whereS7 = 3:12 is the upper sum at HOUR=7, andN7 = 2 is the number ofsuccessive positive upper sums at HOUR=7.

Saving Cusum Scheme Parameters

This example is a continuation of the previous example that illustrates how to saveSee CUSONES1in the SAS/QCSample Library

cusum scheme parameters in a data set specified with the OUTLIMITS= option. Thisenables you to apply the parameters to future data or to subsequently modify theparameters with a DATA step program.

proc cusum data=cans lineprinter;xchart weight*hour /

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 */outlimits = cusparm;

label weight = ’Cusum of Weight’;

proc print data=cusparm;run;

371SAS OnlineDoc: Version 8

Page 14: XCHART Statement

Part 2. The CAPABILITY Procedure

The chart, shown in Figure 12.9, is similar to the one in Figure 12.5 but is createdfor output on a line printer since the LINEPRINTER option is included in the PROCCUSUM statement.�

One-Sided Cusum Analysis

-----------------------------------------------------------------------4 + |

C | |u | |s | |u 3 +==============================*========================================|m | + + |

| + ++ |o | + + |f 2 + + * |

| + + |W | + ++ |e | + + |i 1 + * * |g | + ++ ++* |h | ++ ++ +*++ ++ |t | + *++ ++ ++ |

0 +*++++*++++*++++*++++* ++*+ *++++*|+----+----+----+----+----+----+----+----+----+----+----+----+----+----+1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Hour

Subgroup Sizes: * n=1Parameters: Mu0=8.1 Delta=1 h=3

Figure 12.9. One-Sided Cusum Scheme with Decision Interval

The OUTLIMITS= data set is listed in Figure 12.10.

_ _ _ _ _S L S _ S _ AU _ I C D _ T A R

_ B T M H _ E M D R LV G Y I E M L E D L O

O A R P T _ _ M U T A E I Ub R P E N H K E 0 A N V N Ts _ _ _ _ _ _ _ _ _ _ _ _ _

1 weight hour STANDARD 1 3 0.5 ONESIDED 8.1 1 8.09747 0.05 117.596 6.40391

Figure 12.10. Listing of the OUTLIMITS= Data Set CUSPARM

The data set contains one observation with the parameters forprocessWEIGHT.The variables–TYPE–, –H–, –K–, –MU0–, –DELTA–, and–STDDEV– save theparameters specified with the options SCHEME=, H=, K=, MU0=, DELTA=, andSIGMA0=, respectively. The variable–MEAN– saves an estimate of the processmean, and the variable–LIMITN – saves the nominal sample size. The variables

–ARLIN– and–ARLOUT– save the average run lengths for� = 0 and for� = 1.

�In Release 6.12 and previous releases of SAS/QC software, the keyword GRAPHICS was requiredin the PROC CUSUM statement to specify that the chart be created with a graphics device. In Version7, you can specify the LINEPRINTER option to request line printer plots.

SAS OnlineDoc: Version 8372

Page 15: XCHART Statement

Chapter 12. Getting Started

The variables–VAR– and –SUBGRP– save theprocessand subgroup-variable.The variable–TYPE– is a bookkeeping variable that indicates whether the valueof –STDDEV– is an estimate or a standard value.

For more information, see “OUTLIMITS= Data Set” on page 404.

Reading Cusum Scheme Parameters

This example shows how the cusum parameters saved in the previous example canSee CUSONES1in the SAS/QCSample Library

be applied to new measurements saved in a data set named CANS2:

data cans2;length pump $ 8;label hour = ’Hour’;input hour weight pump $ 8. ;datalines;

16 8.1765 Pump 317 8.0949 Pump 318 8.1393 Pump 319 8.1491 Pump 320 8.0473 Pump 121 8.1602 Pump 122 8.0633 Pump 123 8.0921 Pump 124 8.1573 Pump 125 8.1304 Pump 126 8.0979 Pump 127 8.2407 Pump 128 8.0730 Pump 129 8.0986 Pump 230 8.0785 Pump 231 8.2308 Pump 232 8.0986 Pump 233 8.0782 Pump 234 8.1435 Pump 235 8.0666 Pump 2;

The following statements create a one-sided cusum chart for the measurements inCANS2 using the parameters in CUSPARM:

title ’One-Sided Cusum Analysis for New Data’;

proc cusum data=cans2 limits=cusparm;xchart weight*hour (pump);label weight = ’Cusum of Weight’;

run;

The LIMITS= option in the PROC CUSUM statement specifies the data set contain-ing preestablished cusum parameters.� The chart, shown in Figure 12.11, indicates

�In Release 6.09 and in earlier releases, it is also necessary to specify the READLIMITS option orthe READINDEX= option to read cusum parameters from a LIMITS= data set.

373SAS OnlineDoc: Version 8

Page 16: XCHART Statement

Part 2. The CAPABILITY Procedure

that the process is in control. Levels of the variable PUMP (referred to as ablock-variable) do not enter into the analysis but are displayed in a block legend across thetop of the chart. See “Block Variable Legend Options” in Table 12.7 on page 379.

Figure 12.11. Cusum Chart with Decision Interval for New Data

In general, the parameters for a specifiedprocessand subgroup-variableare readfrom the first observation in the LIMITS= data set for which

� the value of–VAR– matches theprocess(in this case, WEIGHT)� the value of–SUBGRP– matches thesubgroup-variablename (in this case,

HOUR)

If you are maintaining more than one set of cusum parameters for a particularprocess,you will find it convenient to include a special identifier variable named–INDEX–in the LIMITS= data set. This must be a character variable of length 16. Then, ifyou specify READINDEX=’value’ in the XCHART statement, the parameters fora specifiedprocessandsubgroup-variableare read from the first observation in theLIMITS= data set for which

� the value of–VAR– matchesprocess� the value of–SUBGRP– matches thesubgroup-variablename� the value of–INDEX– matchesvalue

In this example, the LIMITS= data set was created in a previous run of the CUSUMprocedure. You can also create a LIMITS= data set with the DATA step. See “LIM-ITS= Data Set” on page 407 for details concerning the variables that you must pro-vide.

SAS OnlineDoc: Version 8374

Page 17: XCHART Statement

Chapter 12. Syntax

Syntax

Specifying One-Sided SchemesThe basic syntax for aone-sided (decision interval) schemeusing the XCHART state-ment is as follows:

XCHART process*subgroup-variable / SCHEME=ONESIDED MU0=targetDELTA=shift H=h < options> ;

The general form of this syntax is as follows:

XCHART (processes)*subgroup-variable<( block-variables) > < =symbol-variablej=’character’ > / SCHEME=ONESIDED MU0=target DELTA=shift H=h < options>;

Note that the options SCHEME=ONESIDED, MU0=, DELTA=, and H= are requiredunless their values are read from a LIMITS= data set.

Specifying Two-Sided SchemesThe basic syntax for atwo-sided (V-mask) schemeis as follows:

XCHART process*subgroup-variable/ MU0=target DELTA=shift ALPHA= alphajH=h< options> ;

The general form of this syntax is as follows:

XCHART (processes)*subgroup-variable<( block-variables)> < =symbol-variablej =’character’ > / MU0=target DELTA=shift ALPHA= alphajH=h < options >;

Note that the options MU0=, DELTA=, and either ALPHA= or H= are required unlesstheir values are read from a LIMITS= data set.

Components of the XCHART StatementYou can use any number of XCHART statements in the CUSUM procedure. Thecomponents of the XCHART statement are described as follows.

processprocesses

identify one or more processes to be analyzed. The specification ofprocessdependson the input data set specified in the PROC CUSUM statement.

� If raw data are read from a DATA= data set,processmust be the name of thevariable containing the raw measurements. For an example, see “Creating aV-Mask Cusum Chart from Raw Data” on page 362.

� If summary data are read from a HISTORY= data set,processmust be the com-mon prefix of the summary variables in the HISTORY= data set. For an exam-ple, see “Creating a V-Mask Cusum Chart from Subgroup Summary Data” onpage 365.

375SAS OnlineDoc: Version 8

Page 18: XCHART Statement

Part 2. The CAPABILITY Procedure

A processis required. If more than oneprocessis specified, enclose the list in paren-theses. The parameters specified in the XCHART statement are applied to all of theprocesses.�

subgroup-variableis the variable that classifies the data into subgroups. Thesubgroup-variableis re-quired. In the examples on pages 362 and 365, HOUR is the subgroup variable.

block-variablesare optionally specified variables that group the data into blocks of consecutive sub-groups. The blocks are labeled in a legend, and eachblock-variableprovides onelevel of labels in the legend. See Figure 12.11 for an example.

symbol-variableis an optionally specified variable whose levels (unique values) determine the plottingcharacter or symbol marker used to plot the cusums.

� If you produce a chart on a line printer, an ‘A’ marks points corresponding tothe first level of thesymbol-variable, a ‘B’ marks points corresponding to thesecond level, and so on.

� If you produce a chart on a graphics device, distinct symbol markers are dis-played for points corresponding to the various levels of thesymbol-variable.You can specify the symbol markers with SYMBOLn statements.

characterspecifies a plotting character for charts produced on line printers. See Figure 12.9 foran example.

optionsspecify optional cusum parameters, enhance the appearance of the chart, request ad-ditional analyses, save results in data sets, and so on. The “Summary of Options”section, which follows, lists all options by function.

Summary of Options

The following tables list the XCHART statement options by function. Options uniqueto the CUSUM procedure are listed in Table 12.1 to Table 12.5, and they are describedin detail in “Dictionary of Special Options” on page 385. Options that are commonto both the CUSUM and SHEWHART procedures are listed in Table 12.14 to Ta-ble 12.17. They are described in detail beginning on page 1613 of Part 9, “TheSHEWHART Procedure.”

�For this reason, it may be preferable to read distinct cusum parameters for eachprocessfrom aLIMITS= data set.

SAS OnlineDoc: Version 8376

Page 19: XCHART Statement

Chapter 12. Syntax

Table 12.1. Options for Specifying a One-Sided (Decision Interval) CusumScheme�

DELTA=value specifies shift to be detected as a multiple of standard error

H=value specifies decision intervalh (h > 0) as a multiple of standarderror

HEADSTART=value specifies headstart valueS0 as a multiple of standard error

K=value specifies reference valuek (k > 0)

LIMITN= n specifies fixed nominal sample size for cusum scheme

LIMITN=VARYING specifies that cusums are to be computed for all subgroups re-gardless of sample size

MU0=value specifies target�0 for mean

NOREADLIMITS specifies that cusum parameters are not to be read from LIMITS=data set (Release 6.10 and later releases)

READINDEX=’value’ reads cusum scheme parameters from a LIMITS= data set

READLIMITS specifies that cusum parameters are to be read from LIMITS=data set (Release 6.09 and earlier releases)

SCHEME=ONESIDED specifies a one-sided scheme

SHIFT=value specifies shift to be detected in data units

SIGMA0=value specifies standard (known) value�0 for process standarddeviation

Table 12.2. Options for Specifying a Two-Sided (V-Mask) Cusum Scheme�

ALPHA=value specifies probability of Type 1 error

BETA=value specifies probability of Type 2 error

H=value specifies vertical distance between V-mask origin and upper (orlower) arm

K=value specifies slope of lower arm of V-mask

LIMITN= n specifies fixed nominal sample size for cusum scheme

LIMITN=VARYING specifies that cusums are to be computed for all subgroups re-gardless of sample size

NOREADLIMITS specifies that cusum parameters are not to be read from LIMITS=data set (Release 6.10 and later releases)

READINDEX=’value’ reads cusum scheme parameters from a LIMITS= data set

READLIMITS specifies that cusum parameters are to be read from LIMITS=data set (Release 6.09 and earlier releases)

READSIGMAS reads–SIGMAS– instead of–ALPHA– from LIMITS= data setwhen both variables are available

SIGMAS=value specifies probability of Type 1 error as probability that standardnormally distributed variable exceedsvaluein absolute value

�The options in these tables are described in the “Dictionary of Special Options” section on page 385.

377SAS OnlineDoc: Version 8

Page 20: XCHART Statement

Part 2. The CAPABILITY Procedure

Table 12.3. Options for Estimating Process Standard Deviation �

SMETHOD=keyword specifies method for estimating process standard deviation�

TYPE=keyword identifies whether–STDDEV– in OUTLIMITS= data set is anestimate or standard, and specifies value of–TYPE– in OUT-LIMITS= data set

Table 12.4. Options for Displaying Decision Interval or V-Mask �

CINFILL=color specifies color for area under decision interval line or inside V-mask

CLIMITS=color specifies color of decision interval line

CMASK=color specifies color of V-mask outline

LLIMITS= linetype specifies line type for decision interval

LMASK= linetype specifies line type for V-mask arms

NOMASK suppresses display of V-mask

ORIGIN=valuej’value’ specifies value ofsubgroup-variablelocating origin of V-mask

WLIMITS=n specifies line width for decision interval

WMASK=n specifies line width for V-mask

Table 12.5. Tabulation Options�

TABLEALL specifies the options TABLECHART, TABLECOMP, TABLEID,TABLEOUT, and TABLESUMMARY

TABLECHART tabulates the information displayed in the cusum chart

TABLECOMP tabulates the computational form of the cusum scheme as de-scribed by Lucas (1976) and Lucas and Crosier (1982)

TABLEID augments TABLECHART and TABLECOMP tables withcolumns for ID variables

TABLEOUT augments TABLECHART table with a column indicating if thedecision interval or V-mask was exceeded

TABLESUMMARY tabulates the parameters for the cusum scheme and the averagerun lengths corresponding to shifts of zero and�

Note that specifying (EXCEPTIONS) after the option TABLECHART creates a tablefor exceptional points only.

�The options in these tables are described in the “Dictionary of Special Options” section on page 385.

SAS OnlineDoc: Version 8378

Page 21: XCHART Statement

Chapter 12. Syntax

Table 12.6. Axis and Axis Label Optionsy

CAXIS=color specifies color for axis lines and tick marks

CFRAME=colorj(color-list)

specifies fill color(s) for frame for plot area

CTEXT=color specifies color for tick mark values and axis labels

HAXIS=valuesjAXISn specifies tick mark values for horizontal axis

HEIGHT=value specifies height of axis label and axis legend text

HMINOR=n specifies number of minor tick marks between major tick markson horizontal axis

HOFFSET=value specifies length of offset at both ends of horizontal axis

INTSTART=value specifies first major tick mark value for numeric horizontal axis

NOHLABEL suppresses label for horizontal axis

NOVANGLE requests vertical axis labels that are strung out vertically

SKIPHLABELS=n specifies thinning factor for tick mark labels on horizontal axis

SPLIT=’character’ specifies splitting character for axis labels

TURNHLABELS requests horizontal axis labels that are strung out vertically

VAXIS=value-listjname specifies major tick mark values for vertical axis of cusum chart

VAXIS2=value-listjname

specifies major tick mark values for vertical axis of trend chart

VMINOR=n specifies number of minor tick marks between major tick markson vertical axis

VOFFSET=value specifies length of offset at both ends of vertical axis

WAXIS=n specifies width of axis lines

Table 12.7. Block Variable Legend Optionsy

BLOCKLABELPOS=keyword

specifies position of label forblock-variablelegend

BLOCKLABTYPE=valuejkeyword

specifies text size ofblock-variablelegend

BLOCKPOS=n specifies vertical position ofblock-variablelegendBLOCKREP repeats identical consecutive labels inblock-variablelegendCBLOCKLAB=color specifies color for filling background inblock-variablelegendCBLOCKVAR=variablej

(variables)specifies one or more variables whose values are colors for fillingbackground ofblock-variablelegend

yThe options in these tables are described in Chapter 46, “Dictionary of Options,” of Part 9, “TheSHEWHART Procedure.”

379SAS OnlineDoc: Version 8

Page 22: XCHART Statement

Part 2. The CAPABILITY Procedure

Table 12.8. Reference Line Optionsy

CHREF=color specifies color for HREF= and HREF2= linesCVREF=color specifies color for VREF= and VREF2= linesHREF=valuesj

SAS-data-setspecifies reference lines perpendicular to horizontal axis oncusum chart

HREF2=valuesjSAS-data-set

specifies reference lines perpendicular to horizontal axis on trendchart

HREFCHAR=’character’ specifies line character for HREF= and HREF2= linesHREFDATA=

SAS-data-setspecifies position of reference lines perpendicular to horizontalaxis on cusum chart

HREF2DATA=SAS-data-set

specifies position of reference lines perpendicular to horizontalaxis on trend chart

HREFLABELS=’label1’...’labeln’

specifies labels for HREF= lines

HREF2LABELS=’label1’...’labeln’

specifies labels for HREF2= lines

HREFLABPOS=n specifies position of HREFLABELS= and HREF2LABELS=labels

LHREF=linetype specifies line type for HREF= and HREF2= linesLVREF=linetype specifies line type for VREF= and VREF2= linesNOBYREF specifies that reference line information in a data set is to be ap-

plied uniformly to charts created for all BY groupsVREF=valuesj

SAS-data-setspecifies reference lines perpendicular to vertical axis on cusumchart

VREF2=valuesjSAS-data-set

specifies reference lines perpendicular to vertical axis on trendchart

VREFCHAR=’character’ specifies line character for VREF= and VREF2= linesVREFLABELS=

’label1’...’labeln’specifies labels for VREF= lines

VREF2LABELS=’label1’...’labeln’

specifies labels for VREF2= lines

VREFLABPOS=n specifies position of VREFLABELS= and VREF2LABELS=labels

yThe options in these tables are described in Chapter 46, “Dictionary of Options,” of Part 9, “TheSHEWHART Procedure.”

SAS OnlineDoc: Version 8380

Page 23: XCHART Statement

Chapter 12. Syntax

Table 12.9. Options for Plotting and Labeling Pointsy

ALLLABEL=VALUE j(variable)

labels every point on cusum chart

ALLLABEL2=VALUE j(variable)

labels every point on trend chart

CCONNECT=color specifies color for line segments that connect points on chart

CFRAMELAB=color specifies fill color for frame around labeled points

CONNECTCHAR=’character’

specifies character used to form line segments that connect pointson chart

COUT=color specifies color for connecting line segments that lie above thedecision interval or outside the V-mask

COUTFILL=color specifies color for areas between connected points and decisioninterval or V-mask

NOCONNECT suppresses line segments that connect points on chart

NOTRENDCONNECT suppresses line segments that connect points on trend chart

OUTLABEL=VALUE j(variable)

labels points exceeding decision interval on one-sided chart

SYMBOLCHARS=’characters’

specifies characters indicatingsymbol-variable

SYMBOLLEGEND=NONEjname

specifies LEGEND statement for levels ofsymbol-variable

SYMBOLORDER=keyword

specifies order in which symbols are assigned for levels ofsymbol-variable

TURNALL turns point labels so that they are strung out vertically

Table 12.10. Phase Optionsy

CPHASELEG=color specifies text color forphaselegend

OUTPHASE=’string’ specifies value of–PHASE– in OUTHISTORY= data set

PHASEBREAK disconnects last point in aphasefrom first point in nextphase

PHASELABTYPE=valuejkeyword

specifies text size ofphaselegend

PHASELEGEND displaysphaselabels in a legend across top of chart

PHASEREF delineatesphaseswith vertical reference lines

READPHASES= ALLj’ label1’...’ labeln’

specifiesphasesto be read from input data set

yThe options in these tables are described in Chapter 46, “Dictionary of Options,” of Part 9, “TheSHEWHART Procedure.”

381SAS OnlineDoc: Version 8

Page 24: XCHART Statement

Part 2. The CAPABILITY Procedure

Table 12.11. Grid Optionsy

ENDGRID adds grid after last plotted point

GRID adds grid to chart

LENDGRID=linetype specifies line type for grid requested with the ENDGRID option

LGRID=linetype specifies line type for grid requested with the GRID option

WGRID=n specifies width of grid lines

Table 12.12. Graphical Enhancement Optionsy

ANNOTATE=SAS-data-set

specifies annotate data set that adds features to cusum chart

ANNOTATE2=SAS-data-set

specifies annotate data set that adds features to trend chart

DESCRIPTION=’string’ specifies string that appears in the description field of PROCGREPLAY master menu for cusum chart

FONT=font specifies software font for labels and legends on charts

NAME=’ string’ specifies name that appears in the name field of the PROC GRE-PLAY master menu for cusum chart

PAGENUM=’string’ specifies the form of the label used in pagination

PAGENUMPOS=keyword

specifies the position of the page number requested with the PA-GENUM= option

WTREND=n specifies width of line segments connecting points on trend chart

Table 12.13. Input Data Set Optionsy

MISSBREAK specifies that observations with missing values are not to beprocessed

Table 12.14. Output Data Set Optionsy

OUTHISTORY=SAS-data-set

creates output data set containing subgroup summary statisticsand cusums

OUTINDEX=’string’ specifies value of–INDEX– in OUTLIMITS= data set

OUTLIMITS=SAS-data-set

creates output data set containing cusum parameters

OUTPHASE=’string’ specifies value of–PHASE– in OUTHISTORY= data set orOUTTABLE= data set

OUTTABLE=SAS-data-set

creates output data set containing subgroup summary statistics,cusums, and decision interval or V-mask values

yThe options in these tables are described in Chapter 46, “Dictionary of Options,” of Part 9, “TheSHEWHART Procedure.”

SAS OnlineDoc: Version 8382

Page 25: XCHART Statement

Chapter 12. Syntax

Table 12.15. Plot Layout Optionsy

ALLN plots summary statistics for all subgroups

BILEVEL creates control charts using half-screens and half-pages

EXCHART creates cusum chart only when exceptions occur

INTERVAL=keyword specifies natural time interval between consecutive subgroup po-sitions when time, date, or datetime format is associated with anumeric subgroup variable

MAXPANELS=n specifies maximum number of pages or screens for chart

NMARKERS requests special markers for points corresponding to sample sizesnot equal to nominal sample size for fixed control limits

NOCHART suppresses creation of cusum chart

NOFRAME suppresses frame for plot area

NOLEGEND suppresses legend for subgroup sample sizes and cusumparameters

NPANELPOS=n specifies number of subgroup positions per panel on each chart

REPEAT repeats last subgroup position on panel as first subgroup positionof next panel

TOTPANELS=n specifies number of pages or screens to be used to display chart

TRENDVAR=variablej(variable-list)

specifies list of trend variables

YPCT1=value specifies length of vertical axis on cusum chart as a percentageof sum of lengths of vertical axes for cusum and trend charts

Table 12.16. Options for Interactive Control Chartsy

HTML=(variable) specifies a variable whose values are URLs to be associated withsubgroups

HTML–LEGEND=(variable)

specifies a variable whose values are URLs to be associated withsymbols in the symbol legend

WEBOUT=SAS-data-set creates an OUTTABLE= data set with additional graphics coor-dinate data

yThe options in these tables are described in Chapter 46, “Dictionary of Options,” of Part 9, “TheSHEWHART Procedure.”

383SAS OnlineDoc: Version 8

Page 26: XCHART Statement

Part 2. The CAPABILITY Procedure

Table 12.17. Star Optionsy

CSTARCIRCLES=color specifies color for circles requested by the STARCIRCLES=option

CSTARFILL=colorj(variable)

specifies color for filling stars

CSTAROUT=color specifies color for outlines of stars that exceed inner or outercircles

CSTARS=colorj(variable)

specifies color for outlines of stars

LABELFONT=font specifies font for labels added with the STARLABEL= option

LSTARCIRCLES=linetypes

specifies line types of circles requested by the STARCIRCLES=option

LSTARS=linetypej(variable)

specifies line types of outlines of stars requested by theSTARVERTICES= option

STARBDRADIUS=value

specifies radius of outer bound circle for vertices of stars

STARCIRCLES=value-list

specifies reference circles for stars

STARINRADIUS=value specifies inner radius of stars

STARLABEL=keyword specifies vertices to be labeled

STARLEGEND=keyword

specifies style of legend for star vertices

STARLEGENDLAB=’label’

specifies label for STARLEGEND= legend

STAROUTRADIUS=value

specifies outer radius of stars

STARSPEC=valuejSAS-data-set

specifies method used to standardize vertex variables

STARSTART=value specifies angle for first vertex

STARTYPE=keyword specifies graphical style of star

STARVERTICES=variablej(variables)

superimposes star at each point on chart

WSTARCIRCLES=n specifies width of circles requested by the STARCIRCLES=option

WSTARS=n specifies width of stars requested by the STARVERTICES=option

yThe options in these tables are described in Chapter 46, “Dictionary of Options,” of Part 9, “TheSHEWHART Procedure.”

SAS OnlineDoc: Version 8384

Page 27: XCHART Statement

Chapter 12. Syntax

Dictionary of Special Options

The marginal notesGraphicsandLine Printer identify options that apply to graphicsdevices and line printers, respectively.

ALPHA= valuespecifies the probability� of incorrectly deciding that a shift has occurred when theprocess mean is equal to the target mean. This is known as the probability of a Type1 error. Thevaluemust be between zero and one, and it is typically set at 0.05 or0.10. If you specify the ALPHA= option, the error probability approach is used todetermine the V-mask. For details, see “Defining the V-Mask for a Two-Sided CusumScheme” on page 395.

The ALPHA= option is applicable only with two-sided cusum schemes. As an alter-native to the ALPHA=value, you can specify the percentilez1��=2 from a standardnormal distribution with the SIGMAS= option. As a second alternative, you canspecify the geometric parameterh for the V-mask (in standard error units) with theH= option.

In addition to the ALPHA= option, you can optionally specify the probability of aType 2 error with the BETA= option.

BETA=valuespecifies the probability� of failing to discover that the specified shift has occurred.This is known as the probability of a Type 2 error. Thevaluemust be between zeroand one. The BETA= option is used in conjunction with either the ALPHA= optionor the SIGMAS= option.

The interpretation of� is based on the analogy between cusum charts and sequentialprobability ratio tests, and it is inexact since the cusum chart does not provide anacceptance region. Refer to Johnson (1961) and van Dobben de Bruyn (1968) forfurther details.

CINFILL=colorspecifies the color for the area under the decision interval or inside the V-mask arms.GraphicsBy default, these areas are not filled with a color. See also the COUTFILL= option.

CLIMITS=colorspecifies the color for the decision interval line. The default color is the first color inGraphicsthe device color list.

CMASK=colorspecifies the color for the V-mask arms. The default color is the first color in theGraphicsdevice color list.

DATAUNITScomputes cumulative sums without standardizing the subgroup means or individualmeasurements. As a result, the vertical axis of the cusum chart is scaled in the sameunits as the data.

The DATAUNITS option requires constant subgroup sample sizes. If your data donot have constant subgroup sample sizes, you need to specify a constant nominal

385SAS OnlineDoc: Version 8

Page 28: XCHART Statement

Part 2. The CAPABILITY Procedure

sample sizen for the V-mask or decision interval with the LIMITN= option or withthe variable–LIMITN – in the LIMITS= data set.

DELTA=valuespecifies the absolute value of the smallest shift to be detected as a multiple� of theprocess standard deviation� or the standard error� �X , depending on whether� isviewed as a shift in the population mean or a shift in the sampling distribution of thesubgroup mean�X, respectively.

If you specify SCHEME=ONESIDED (see the SCHEME= option later in this list)and thevalueis positive, a shift above the process mean is to be detected, whereas ifthevalueis negative, a shift below the process mean is to be detected.

As an alternative to specifying the DELTA= option, you can specify the shift in thesame units as the data with the SHIFT= option.

H=valuespecifies the decision intervalh for a one-sided cusum scheme. This type of schemeis completely specified by the parametersh andk (see the K= option later in this list).You can also specify the H= option as an alternative to the ALPHA= or SIGMAS=options for a two-sided cusum scheme with a V-mask. In this case, the H= optionspecifies the vertical distanceh between the origin for the V-mask and the upper orlower arm of the V-mask. In either case, the H=valuemust be positive and must beexpressed as a multiple of standard error.

You can use a table of average run lengths to chooseh (this is typically between zeroand 10). See pages 399 and 400.

HEADSTART=valueHSTART=value

specifies a headstart valueS0 for a one-sided cusum scheme. The value must beexpressed as a multiple of standard error. See "Headstart Values" on page 392, andrefer to Lucas and Crosier (1982), Ryan (1989), and Montgomery (1996).

K=valuespecifies the reference valuek for a one-sided (decision interval) cusum scheme.This type of scheme is completely specified by the parametersk andh (see the H=option earlier in this list). You can also specify the K= and H= options as geometricparameters for a two-sided cusum scheme with a V-mask . In this case, the K=option specifies the slope of the lower arm of the V-mask, and the K= and H= optionstogether are alternatives to the error probability options ALPHA=, SIGMAS=, andBETA=. In either case, the K=valuemust be positive and must be expressed as amultiple of standard error.

You can use a table of average run lengths to choosek andh (k is typically betweenzero and two). See pages 399 and 400.

For a one-sided scheme, the default K=valueis �=2, which is referred to as thecentralreference value. For a two-sided scheme where the V-mask is specified geometricallywith the H= option, the default K=valueis �=2. If, however, the V-mask is specifiedby an error probability with the ALPHA= option, then the K= option should not bespecified.

SAS OnlineDoc: Version 8386

Page 29: XCHART Statement

Chapter 12. Syntax

CAUTION: The interpretation of the K=value depends on thesubgroup-variableand the interval between subgroups that is specified with the INTERVAL= option.For a two-sided scheme, thevalue is the increase in the lower V-mask arm per unitchange on the subgroup axis, so thevaluedepends on how thesubgroup-variableisscaled.

� If integer values are assigned to thesubgroup-variable, then a unit change isdefined as one.

� If the subgroup-variablehas character values, then a unit change is defined asthe increment between adjacent values of thesubgroup-variable.

� If the subgroup-variableis numeric and is formatted with a SAS date or timeformat, then a unit change is defined as the default value for the INTERVAL=option. For example, if a DATE7. format is associated with thesubgroup-variable, then a unit change is defined as one day.

You can use the INTERVAL= option to modify the definition of a unit change. Forexample, if a DATE7. format is associated with thesubgroup-variablebut subgroupsare collected hourly, then INTERVAL=HOUR defines a unit change as one hourrather than one day.

LIMITN=nLIMITN=VARYING

specifies either a fixed or varying nominal sample size for the control limits. If youspecify LIMITN=n, cusums are calculated and displayed only for those subgroupswith a sample size equal ton, although you can specify the ALLN option to force allcusums to be plotted. If you specify LIMITN=VARYING, cusums are calculated anddisplayed for all subgroups, regardless of sample size.

LLIMITS= linetypespecifies the line type for the decision interval. The default is 4 (a dashed line). Graphics

LMASK= linetypespecifies the line type for the V-mask arms. The default is 1 (a solid line). Graphics

MU0=valuespecifies the target mean�0 for the process. The target mean must be scaled in thesame units as the data.

NOARLsuppresses calculation of average run lengths. By default, this calculation is per-formed if you specify the TABLESUMMARY option or an OUTLIMITS= data set.

NOMASKsuppresses the display of the V-mask on charts for two-sided schemes. This optiondoes not affect computations of cusums or V-mask parameters.

NOREADLIMITSspecifies that the cusum scheme parameters for eachprocesslisted in the chart state-ment arenot to be read from the LIMITS= data set specified in the PROC CUSUMstatement. The NOREADLIMITS option is available only in Release 6.10 and laterreleases. See the READLIMITS option later in this list.

387SAS OnlineDoc: Version 8

Page 30: XCHART Statement

Part 2. The CAPABILITY Procedure

ORIGIN=valuespecifies the origin of the V-mask, which is defined as the horizontal coordinate ofthe right edge of the V-mask. If a date, time, or datetime format is associated with thesubgroup-variable, you must specify thevalueas a date, time, or datetime constant,respectively. If the subgroup variable is character, you must specify thevalue asa quoted string. The defaultvalue is the last (most recent) value of thesubgroup-variable.

Note that estimates for the process mean and standard deviation are calculated onlyfrom subgroups up to and including the origin subgroup.

READINDEX=’value’reads cusum scheme parameters from a LIMITS= data set (specified in the PROCCUSUM statement) for eachprocesslisted in the chart statement. Theith set of con-trol limits for a particularprocessis read from the first observation in the LIMITS=data set for which

� the value of–VAR– matchesprocess� the value of–SUBGRP– matches thesubgroup-variable� the value of–INDEX– matchesvalue

Thevaluecan be up to 16 characters and must be enclosed in quotes.

READLIMITSspecifies that cusum scheme parameters are to be read from a LIMITS= data setspecified in the PROC CUSUM statement. The parameters for a particularprocessare read from the first observation in the LIMITS= data set for which

� the value of–VAR– matchesprocess� the value of–SUBGRP– matches thesubgroup variable

The use of the READLIMITS option depends on which release of SAS/QC softwareyou are using.

� In Release 6.10 and later releases, the READLIMITS option is not neces-sary. To read cusum scheme parameters as described previously, you simplyspecify a LIMITS= data set. However, even though the READLIMITS optionis redundant, it continues to function as in earlier releases.

� In Release 6.09 and earlier releases, you must specify the READLIMITSoption to read cusum scheme parameters as described previously.If youspecify a LIMITS= data set without specifying the READLIMITS option (orthe READINDEX= option), the cusum scheme parameters are computed fromthe data.

READSIGMASspecifies that the variable–SIGMAS– (instead of–ALPHA–) is to be read froma LIMITS= data set that contains both variables. The variables–SIGMAS– and

–ALPHA– provide the same parameters as the SIGMAS= and ALPHA= options. Bydefault,–ALPHA– is read from the LIMITS= data set.

SAS OnlineDoc: Version 8388

Page 31: XCHART Statement

Chapter 12. Syntax

SCHEME=ONESIDEDSCHEME=TWOSIDED

indicates whether the cusum scheme is a one-sided (decision interval) scheme or atwo-sided scheme with a V-mask. By default, SCHEME=TWOSIDED.

SHIFT=valuespecifies the shift to be detected in the same units as the data. Thevalue is inter-preted as the shift in the mean of the sampling distribution of the subgroup mean.The SHIFT= option is an alternative to the DELTA= option. To specify the SHIFT=option, one of the following must be true:

� The subgroup sample sizes are constant.

� A constant nominal sample sizen is provided for the cusum scheme with theLIMITN= option or the–LIMITN – variable in a LIMITS= data set.

The relationship between the SHIFT=value(denoted by�) and the DELTA= value(denoted by�) is � = �=(�=

pn), where� is the process standard deviation.

SIGMA0=valuespecifies a known standard deviation�0 for the process standard deviation�. Thevaluemust be positive. By default, PROC CUSUM estimates� from the data usingthe formulas given in “Methods for Estimating the Standard Deviation” on page 401.You can use the variable–STDDEV– in a LIMITS= data set as an alternative to theSIGMA0= option.

SIGMAS=valuespecifies the probability� of false detection for a two-sided cusum scheme with aV-mask as the probability that the absolute value of a standard normally distributedvariable is greater than thevalue. For example, SIGMAS=3 corresponds to the proba-bility � =0.0027. Thevaluemust be positive. The SIGMAS= option is an alternativeto the ALPHA= and H= options, and only one of these three options can be specified.

The SIGMAS= option is useful for defining cusum charts that correspond to Shewhartcharts whose control limits are defined with the samevalueas the multiple of�. Referto Johnson and Leone (1962, 1974).

SMETHOD=NOWEIGHT | MVLUE | RMSDFspecifies a method for estimating the process standard deviation from subgroup ob-servations,�, as summarized by the following table.

Keyword Method for Estimating Standard Deviation

NOWEIGHT estimates� as an unweighted average of unbiased subgroupestimates of�

MVLUE calculates a minimum variance linear unbiased estimate for�

RMSDF calculates a root-mean square estimate for�

For formulas, see “Methods for Estimating the Standard Deviation” on page 401.

TABLEALLrequests all the tables specified by the options TABLECHART, TABLECOMP,TABLEID, TABLEOUT, and TABLESUMMARY.

389SAS OnlineDoc: Version 8

Page 32: XCHART Statement

Part 2. The CAPABILITY Procedure

TABLECHART <(EXCEPTIONS)>creates a table of the subgroup variable, the subgroup sample sizes, the subgroupmeans, the cumulative sums, and the decision interval or V-mask limits. A tableis produced for eachprocessspecified in the XCHART statement. The keywordEXCEPTIONS (enclosed in parentheses) is optional and restricts the tabulation tothose subgroups for which the decision interval or V-mask values are exceeded.

TABLECOMPtabulates the computational form of the cusum scheme as described by Lucas (1976)and Lucas and Crosier (1982). Upper or lower cumulative sums (or both) are tabu-lated for eachprocessgiven in the XCHART statement. See “Formulas for Cumula-tive Sums” on page 392 for more information.

TABLEIDaugments the tables specified by the TABLECHART and TABLECOMP options witha column for each of the ID variables.

TABLEOUTaugments the table specified by the TABLECHART option with a column indicatingwhether the decision interval or V-mask values are exceeded.

TABLESUMMARYproduces a table that summarizes the cusum scheme. The table lists the parametersof the scheme and the average run lengths corresponding to shifts of zero and�. Theaverage run lengths are computed using the method of Goel and Wu (1971). A tableis produced for eachprocess. You can save the summary in a data set by specifyingthe OUTLIMITS= option. See “OUTLIMITS= Data Set” on page 404 for details.

TYPE=ESTIMATETYPE=STANDARD

specifies the value of–TYPE– in an OUTLIMITS= data set. The variable–TYPE–indicates whether the variable–STDDEV– in the OUTLIMITS= data set representsan estimate or a standard (known) value. The default isSTANDARDif the SIGMA0=option is specified; otherwise, the default isESTIMATE.

WLIMITS=linetypespecifies the width (in pixels) of the decision interval line. The default width is 1.Graphics

WMASK= linetypespecifies the width (in pixels) of the V-mask arms. The default width is 1.Graphics

SAS OnlineDoc: Version 8390

Page 33: XCHART Statement

Chapter 12. Details

Details

Basic Notation for Cusum Charts

The following notation is used in this chapter:

� denotes the mean of the population, also referred to as theprocess meanortheprocess level.

�0 denotes the target mean (goal) for the population. Goel and Wu (1971) referto �0 as the “acceptable quality level” and use the symbol�a instead. Thesymbol �X0 is used for�0 in Glossary and Tables for Statistical Quality Con-trol. You can provide�0 with the MU0= option or with the variable–MU0–in a LIMITS= data set.

� denotes the population standard deviation. You can provide� with the vari-able–STDDEV– in a LIMITS= data set (where–TYPE–=STANDARD).

�0 denotes a known standard deviation. You can provide�0 with the SIGMA0=option or the variable–STDDEV– in a LIMITS= data set.

� denotes an estimate of�. You can provide� with the SIGMA0= option orthe variable–STDDEV– in a LIMITS= data set. To identify this value as anestimate, specify TYPE=ESTIMATE or assign the valueESTIMATEto thevariable–TYPE– in a LIMITS= data set.

n denotes the nominal sample size for the cusum scheme. You can providenwith the LIMITN= option or the variable–LIMITN – in a LIMITS= data set.

� denotes the shift in� to be detected, expressed as a multiple of the stan-dard deviation. You can provide� with the DELTA= option or the variable

–DELTA– in a LIMITS= data set.

� denotes the shift in� to be detected, expressed in data units. If the samplesizen is constant across subgroups, then� = �� �X = (��)=

pn.

Some authors use the symbol D instead of�; for example, refer to Johnsonand Leone (1962, 1974) and Wadsworth and others (1986). You can provide� with the SHIFT= option. Although it may be more natural to specifythe shift in data units, it is preferable to specify the shift as�, since thisgeneralizes to data with unequal subgroup sample sizes.

391SAS OnlineDoc: Version 8

Page 34: XCHART Statement

Part 2. The CAPABILITY Procedure

Formulas for Cumulative Sums

One-Sided Cusum Schemes

Positive ShiftsIf the shift � to be detected is positive, the cusum computed for thetth subgroup is

St = max(0; St�1 + (zt � k))

for t=1, 2, . . . ,n, whereS0=0, zt is defined as for two-sided schemes, and theparameterk, termed thereference value, is positive. The cusumSt is referred to asanupper cumulative sum. SinceSt can be written as

max

�0; St�1 +

�Xi � (�0 + k� �Xi)

� �Xi

the sequenceSt cumulates deviations in the subgroup means greater thank standarderrors from�0. If St exceeds a positive valueh (referred to as thedecision interval),a shift or out-of-control condition is signaled. This formulation follows that of Lucas(1976), Lucas and Crosier (1982), and Montgomery (1996).

Negative ShiftsIf the shift � to be detected is negative, the cusum computed for thetth subgroup is

St = max(0; St�1 � (zt + k))

for t=1, 2, . . . ,n, whereS0=0, zt is defined as for two-sided cusum schemes, andthe parameterk, termed thereference value, is positive. The cusumSt is referred toas alower cumulative sum. SinceSt can be written as

max

�0; St�1 �

�Xi � (�0 � k� �Xi)

� �Xi

the sequenceSt cumulates the absolute value of deviations in the subgroup meansless thank standard errors from�0. If St exceeds a positive valueh (referred to asthedecision interval), a shift or out-of-control condition is signaled.

This formulation follows that of Lucas (1976), Lucas and Crosier (1982), and Mont-gomery (1996). Note thatSt is always positive andh is always positive, regardlessof whether� is positive or negative. For schemes designed to detect a negative shift,some authors, including van Dobben de Bruyn (1968) and Wadsworth and others(1986), define a reflected version ofSt for which a shift is signaled whenSt is lessthan a negative limit.

Headstart ValuesLucas and Crosier (1982) describe the properties of a fast initial response (FIR) fea-ture for cusum schemes in which the initial cusumS0 is set to a “headstart” value.Average run length calculations given by Lucas and Crosier (1982) show that the

SAS OnlineDoc: Version 8392

Page 35: XCHART Statement

Chapter 12. Details

FIR feature has little effect when the process is in control and that it leads to afaster response to an initial out-of-control condition than a standard cusum scheme.You can provide headstart valueS0 with the HEADSTART= option or the variable

–HSTART– in a LIMITS= data set.

Constant Sample SizesWhen the subgroup sample sizes are constant (=n), it may be preferable to computecusums that are scaled in the same units as the data. Refer to Montgomery (1996)and Wadsworth and others (1986). To request this, specify the DATAUNITS option.Cusums are then computed as

St = max(0; St�1 + ( �Xi � (�0 + k�=pn)))

for � >0 and the equation

St = max(0; St�1 � ( �Xi � (�0 � k�=pn)))

for � < 0. In either case, a shift is signaled ifSt exceedsh0 = h�=pn. Wadsworth

and others (1986) use the symbolH for h0.

If the subgroup sample sizes are not constant, you can specify a constant nominalsample sizen with the LIMITN= option or the variable–LIMITN – in a LIMITS=data set. In this case, only those subgroups with sample sizen are analyzed unlessyou also specify the option ALLN. You can further specify the option NMARKERSto request special symbol markers for points corresponding to sample sizes not equalto n.

Two-Sided Cusum Schemes

If the cusum scheme is two-sided, the cumulative sumSt plotted for thetth subgroupis

St = St�1 + zt

for t=1, 2, . . . ,n. HereS0=0, and the termzt is calculated as

zt = ( �Xt � �0)=(�=pnt)

where �Xt is thetth subgroup average, andnt is thetth subgroup sample size. If thesubgroup samples consist of individual measurementsxt, the termzt simplifies to

zt = (xt � �0)=�

Since the first equation can be rewritten as

St =

tXi=1

zi =

tXi=1

( �Xi � �0)=� �Xi

393SAS OnlineDoc: Version 8

Page 36: XCHART Statement

Part 2. The CAPABILITY Procedure

the sequenceSt cumulates standardized deviations of the subgroup averages from thetarget mean�0.

In many applications, the subgroup sample sizesni are constant (ni = n), and theequation forSt can be simplified.

St = (1=� �X)

tXi=1

( �Xi � �0) = (pn=�)

tXi=1

( �Xi � �0)

In some applications, it may be preferable to computeSt as

St =

tXi=1

( �Xi � �0)

which is scaled in the same units as the data. Refer to Montgomery (1996),Wadsworth and others (1986), andASQC Glossary and Tables for Statistical Qual-ity Control. If the subgroup sample sizes are constant (=n) and if you specify theDATAUNITS option in the XCHART statement, the CUSUM procedure computescusums using the final equation above. In this case, the procedure rescales the V-mask parametersh andk toh0 = h�=

pn andk0 = k�=

pn, respectively. Wadsworth

and others (1986) use the symbolsF for k0 andH for h0.

If the subgroup sample sizes are not constant, you can specify a constant nominalsample sizen with the LIMITN= option or with the variable–LIMITN – in a LIM-ITS= data set. In this case, only those subgroups with sample sizen are analyzed un-less you also specify the option ALLN. You can further specify the option NMARK-ERS to request special symbol markers for points corresponding to sample sizes notequal ton.

If the process is in control and the mean� is at or near the target�0, the points willnot exhibit a trend since positive and negative displacements from�0 tend to canceleach other. If� shifts in the positive direction, the points exhibit an upward trend,and if� shifts in the negative direction, the points exhibit a downward trend.

Defining the Decision Interval for a One-Sided Cusum Scheme

The height of the decision interval ish, expressed as a multiple of the standard error ofthe subgroup mean. You can specifyh with the H= option in the XCHART statementor with the variable–H– in a LIMITS= data set. The decision interval is displayedas a horizontal line on the cusum chart, as illustrated in Figure 12.12.

SAS OnlineDoc: Version 8394

Page 37: XCHART Statement

Chapter 12. Details

tC

umul

ativ

e S

um (

S )

0

Subgroup Index (t) 1 2 3 4 5 6 7 8 9 10

h

Figure 12.12. Decision Interval

Interpreting One-Sided Cusum ChartsA shift or out-of-control condition is signaled at timet if the cusumSt plotted at timet exceeds the decision interval line.

Defining the V-Mask for a Two-Sided Cusum Scheme

The dimensions of the V-mask can be specified using two distinct sets of two param-eters.

� �, defined as half of the angle formed by the V-mask arms, andd, the distancebetween the origin and the vertex, as shown in Figure 12.13. This parameteri-zation is used by many authors, including Johnson and Leone (1962, 1974) andMontgomery (1996).

� h, the vertical distance between the origin and the upper (or lower) V-mask arm,andk, the rise (drop) in the lower (upper) arm corresponding to an interval ofone subgroup unit on the horizontal axis. You can specify the definition of aninterval with the INTERVAL= option. This parameterization is used by Lucas(1976) and Wadsworth and others (1986). Lucas (1976) uses the symbolsh�

for h andk� for k, and Wadsworth and others (1986) use the symbolf in placeof k.

The two parameterizations are related by the equations

� = arctan(k=a)

d = h=k

395SAS OnlineDoc: Version 8

Page 38: XCHART Statement

Part 2. The CAPABILITY Procedure

where the aspect ratioa is the number of units on the vertical axis corresponding toone unit on the horizontal axis. The CUSUM procedure uses theh andk parame-terization because it eliminates the need for working with aspect ratios, which aredependent on the graphics device. Furthermore,h andk are also useful for averagerun length computations and for parameterizing one-sided cusum schemes.

k

Lower Arm

t

Origin

θ

d

h

Vertex

Upper Arm

1

Subgroup Index (t)

Cum

ulat

ive

Sum

(S

)

1 2 3 4 5 6 7 8 9 10

Figure 12.13. V-Mask Parameters

You can specify the V-mask in two ways:

� geometrically, by providingh andk (or simplyh) with the H= and K= optionsor with the variables–H– and–K– in a LIMITS= data set

� in terms of error probabilities, by providing� and� (or simply �) with theALPHA= and BETA= options or with the variables–ALPHA– and–BETA–in a LIMITS= data set. The SIGMAS= option is an alternative to the ALPHA=option, and the variable–SIGMAS– is an alternative to the variable–ALPHA–(if the READSIGMAS option is specified).

If you provide� and�, h andk are computed using the formulas

h = j�j�1 log((1� �)=(�=2))

k = j�j=2

SAS OnlineDoc: Version 8396

Page 39: XCHART Statement

Chapter 12. Details

If you provide� but not�, h andk are computed using the formulas

h = �j�j�1 log(�=2)

k = j�j=2

In the preceding equations, the error probability� is divided by two because two-sided deviations from the target mean are detected. Refer to Johnson and Leone(1962, 1974).

Interpreting Two-Sided Cusum ChartsThe origin of the V-mask is located at the most recently plotted point, as illustratedin Figure 12.13. As additional data are collected and the cumulative sum sequence isupdated, the origin is relocated at the newest point. A shift or out-of-control conditionis signaled at timet if one or more of the points plotted up to timet cross an arm ofthe V-mask. An upward shift is signaled by points crossing the lower arm, and adownward shift is signaled by points crossing the upper arm. The time at which theshift occurred corresponds to the time at which a distinct change is observed in theslope of the plotted points.

Designing a Cusum Scheme

There are three main methods for designing a cusum scheme: theaverage run length(ARL) approach, theerror probability approach, and theeconomic design approach.

Average Run Length (ARL) ApproachWith the ARL approach, the parametersh andk are chosen to yield desired averagerun lengths when the process is operating at the target mean and when a shift ofmagnitude� has occurred. The average run length is the expected number of samplestaken before an out-of-control condition is signaled. Ideally, the ARL should be longwhen� = �0 and short when� shifts away from�0.

The ARL method typically involves the use of a table or nomogram. Refer to Kemp(1961), van Dobben de Bruyn (1968), Goel and Wu (1971), Duncan (1974), Lucas(1976), Montgomery (1996), and Wadsworth and others (1986).

For one-sided charts, average run lengths are tabulated as a function ofh, k, and�in Table 12.18 on page 399. No headstart is assumed in this table. For two-sidedcharts, average run lengths are tabulated as a function ofh, k, and� in Table 12.19on page 400, which is formatted similarly to Table 2 given by Lucas (1976).

The ARLs in Table 12.18 and Table 12.19 were calculated with the DATA step func-tion CUSUMARL, which is described on page 1849. This function uses the methodof Goel and Wu (1971). You can use this function to generate more detailed, interpo-lated versions of the tables or to compute ARLs with headstart values.

It can be shown that the two-sided (V-mask) cusum scheme parameterized byh andk is equivalent to two simultaneously operating one-sided cusum schemes, one thatcomputes an upper cusum and one that computes a lower cusum. Both one-sidedschemes use the same parametersh andk.

397SAS OnlineDoc: Version 8

Page 40: XCHART Statement

Part 2. The CAPABILITY Procedure

You can specifyh, k, and � with the options H=, K=, and DELTA= or with thevariables–H–, –K–, and–DELTA– in a LIMITS= data set. The reference valuek isoptional, and its default value isk = j�j=2, referred to as thecentral reference value.

Error Probability ApproachThis approach is available only for two-sided cusum schemes. Values of� (the prob-ability of incorrectly signaling the occurrence of a shift) and� (the probability offailing to detect a shift) are specified, andh andk are computed from� and� as de-scribed in “Defining the V-Mask for a Two-Sided Cusum Scheme” on page 395. Theerror probability approach interprets the cusum as a sequence of reversed sequentialprobability ratio tests. Refer to Johnson (1961), Johnson and Leone (1962, 1974), vanDobben de Bruyn (1968), Montgomery (1996), and Wadsworth and others (1986).

Although the error probability method is intuitively appealing, the actual error prob-abilities achieved may not be close to those specified since the V-mask does not pro-vide for an acceptance region. This has been pointed out by various authors, includingJohnson (1961) and van Dobben de Bruyn (1968). If you follow this approach, it isrecommended that you examine the average run lengths for the cusum scheme (theseare tabulated by the TABLESUMMARY option and are saved in OUTLIMITS= datasets).

You can specify� and� with the ALPHA= and BETA= options or with the variables

–ALPHA– and–BETA– in a LIMITS= data set. It is not necessary to specify�,and the interpretation of� is somewhat questionable. The SIGMAS= option is analternative to the ALPHA= option, and the variable–SIGMAS– is an alternative tothe variable–ALPHA– (if you specify the READSIGMAS option).

Economic DesignThe parametersn, h, andk are chosen so that the long-run average cost of the cusumscheme is minimized. Refer to Chiu (1974), Montgomery (1980), Svoboda (1991),and Ho and Case (1994) for reviews of the literature on economic design. This ap-proach typically requires numerical optimization techniques, which are available inSAS/IML software and in the NLP procedure in SAS/OR software.

You can pass the optimal parameters to the CUSUM procedure as values of the vari-ables–LIMITN –, –H–, and–K– in a LIMITS= data set.

SAS OnlineDoc: Version 8398

Page 41: XCHART Statement

Chapter 12. Details

Table 12.18. Average Run Lengths for One-Sided V-Mask Cusum Charts as aFunction of h, k, and �.

Parameters � (shift in mean)

h k 0.00 0.25 0.50 0.75 1.00 1.50 2.00 2.50 3.00 4.00 5.00

2.50 0.25 27.27 13.43 7.96 5.42 4.06 2.71 2.06 1.68 1.42 1.11 1.014.00 0.25 77.08 26.68 13.29 8.38 6.06 3.91 2.93 2.38 2.05 1.61 1.236.00 0.25 350.80 51.34 20.90 12.37 8.73 5.51 4.07 3.26 2.74 2.13 1.908.00 0.25 736.78 84.00 28.76 16.37 11.39 7.11 5.21 4.15 3.48 2.67 2.14

10.00 0.25 2071.51 124.66 36.71 20.37 14.06 8.71 6.36 5.04 4.20 3.20 2.65

2.00 0.50 38.55 18.19 10.00 6.32 4.45 2.74 1.99 1.58 1.32 1.07 1.013.00 0.50 117.60 39.47 17.35 9.68 6.40 3.75 2.68 2.12 1.77 1.31 1.074.00 0.50 335.37 77.08 26.68 13.29 8.38 4.75 3.34 2.62 2.19 1.71 1.315.00 0.50 930.89 141.69 38.01 17.05 10.38 5.75 4.01 3.11 2.57 2.01 1.696.00 0.50 2553.11 250.80 51.34 20.90 12.37 6.75 4.68 3.62 2.98 2.24 1.95

1.50 0.75 42.57 21.09 11.59 7.09 4.78 2.73 1.90 1.48 1.24 1.04 1.002.25 0.75 139.71 51.46 22.38 11.66 7.13 3.73 2.51 1.91 1.56 1.16 1.023.00 0.75 442.80 117.60 39.47 17.35 9.68 4.73 3.12 2.36 1.93 1.41 1.113.75 0.75 1375.71 258.96 65.65 24.16 12.37 5.73 3.71 2.79 2.27 1.72 1.314.50 0.75 4251.69 559.95 105.12 32.09 15.15 6.73 4.31 3.21 2.59 1.97 1.60

1.00 1.00 35.29 19.22 11.21 7.03 4.75 2.63 1.78 1.38 1.17 1.02 1.001.50 1.00 93.85 42.57 21.09 11.59 7.09 3.50 2.24 1.66 1.34 1.07 1.012.00 1.00 258.67 94.34 38.55 18.19 10.00 4.45 2.74 1.99 1.58 1.16 1.022.50 1.00 716.00 205.97 68.19 27.27 13.43 5.42 3.25 2.34 1.85 1.31 1.073.00 1.00 1962.79 442.80 117.60 39.47 17.35 6.40 3.75 2.68 2.12 1.52 1.163.50 1.00 5341.40 943.73 199.57 55.69 21.76 7.39 4.25 3.01 2.37 1.73 1.31

0.70 1.50 67.72 36.03 20.26 12.07 7.63 3.66 2.18 1.55 1.25 1.04 1.001.10 1.50 184.28 86.36 42.72 22.50 12.74 5.17 2.80 1.86 1.43 1.08 1.011.50 1.50 549.69 221.49 93.85 42.57 21.09 7.09 3.50 2.24 1.66 1.16 1.021.90 1.50 1762.09 595.61 210.95 80.54 34.26 9.38 4.26 2.64 1.92 1.29 1.052.30 1.50 5897.30 1638.15 476.90 151.04 54.47 12.00 5.03 3.04 2.20 1.45 1.12

399SAS OnlineDoc: Version 8

Page 42: XCHART Statement

Part 2. The CAPABILITY Procedure

Table 12.19. Average Run Lengths for Two-Sided V-Mask Cusum Charts as aFunction of h, k, and �.

Parameters � (shift in mean)

h k 0.00 0.25 0.50 0.75 1.00 1.50 2.00 2.50 3.00 4.00 5.00

2.50 0.25 13.64 11.22 7.67 5.38 4.06 2.71 2.06 1.68 1.42 1.11 1.014.00 0.25 38.54 24.71 13.20 8.38 6.06 3.91 2.93 2.38 2.05 1.61 1.236.00 0.25 125.40 50.33 20.89 12.37 8.73 5.51 4.07 3.26 2.74 2.13 1.908.00 0.25 368.39 83.63 28.76 16.37 11.39 7.11 5.21 4.15 3.48 2.67 2.14

10.00 0.25 1035.75 124.55 36.71 20.37 14.06 8.71 6.36 5.04 4.20 3.20 2.65

2.00 0.50 19.27 15.25 9.63 6.27 4.44 2.74 1.99 1.58 1.32 1.07 1.013.00 0.50 58.80 36.24 17.20 9.67 6.40 3.75 2.68 2.12 1.77 1.31 1.074.00 0.50 167.68 74.22 26.63 13.29 8.38 4.75 3.34 2.62 2.19 1.71 1.315.00 0.50 465.44 139.49 38.00 17.05 10.38 5.75 4.01 3.11 2.57 2.01 1.696.00 0.50 1276.55 249.26 51.34 20.90 12.37 6.75 4.68 3.62 2.98 2.24 1.95

1.50 0.75 21.28 17.22 11.01 7.00 4.77 2.73 1.90 1.48 1.24 1.04 1.002.25 0.75 69.85 45.97 22.04 11.63 7.13 3.73 2.51 1.91 1.56 1.16 1.023.00 0.75 221.40 110.95 39.31 17.34 9.68 4.73 3.12 2.36 1.93 1.41 1.113.75 0.75 687.85 251.56 65.58 24.16 12.37 5.73 3.71 2.79 2.27 1.72 1.314.50 0.75 2125.85 552.11 105.09 32.09 15.15 6.73 4.31 3.21 2.59 1.97 1.60

1.00 1.00 17.65 15.03 10.39 6.88 4.72 2.63 1.78 1.38 1.17 1.02 1.001.50 1.00 46.92 35.70 20.31 11.49 7.07 3.50 2.24 1.66 1.34 1.07 1.012.00 1.00 129.34 84.00 37.93 18.14 10.00 4.45 2.74 1.99 1.58 1.16 1.022.50 1.00 358.00 191.48 67.76 27.25 13.43 5.42 3.25 2.34 1.85 1.31 1.073.00 1.00 981.39 423.29 117.32 39.47 17.35 6.40 3.75 2.68 2.12 1.52 1.163.50 1.00 2670.70 917.89 199.40 55.69 21.76 7.39 4.25 3.01 2.37 1.73 1.31

0.70 1.50 33.86 28.41 18.90 11.84 7.59 3.66 2.18 1.55 1.25 1.04 1.001.10 1.50 92.14 71.41 40.91 22.29 12.71 5.17 2.80 1.86 1.43 1.08 1.011.50 1.50 274.84 191.58 91.58 42.39 21.07 7.09 3.50 2.24 1.66 1.16 1.021.90 1.50 881.05 536.07 208.31 80.41 34.25 9.38 4.26 2.64 1.92 1.29 1.052.30 1.50 2948.65 1523.15 474.09 150.96 54.47 12.00 5.03 3.04 2.20 1.45 1.12

SAS OnlineDoc: Version 8400

Page 43: XCHART Statement

Chapter 12. Details

Cusum Charts Compared with Shewhart Charts

Although cusum charts and Shewhart charts are both used to detect shifts in the pro-cess mean, there are important differences in the two methods.

� Each point on a Shewhart chart is based on information for a single subgroupsample or measurement. Each point on a cusum chart is based on informa-tion from all samples (measurements) up to and including the current sample(measurement).

� On a Shewhart chart, upper and lower control limits are used to decide whethera point signals an out-of-control condition. On a cusum chart, the limits takethe form of a decision interval or a V-mask.

� On a Shewhart chart, the control limits are commonly computed as 3� limits.On a cusum chart, the limits are determined from average run length specifica-tions, specified error probabilities, or an economic design.

A cusum chart offers several advantages over a Shewhart chart.

� A cusum chart is more efficient for detecting small shifts in the process mean,in particular, shifts of 0.5 to 2 standard deviations from the target mean (referto Montgomery 1996). Lucas (1976) noted that “a V-mask designed to detect a1� shift will detect it about four times as fast as a competing Shewhart chart.”

� Shifts in the process mean are visually easy to detect on a cusum chart sincethey produce a change in the slope of the plotted points. The point at which theslope changes is the point at which the shift has occurred.

These advantages are not as pronounced if the Shewhart chart is augmented by thetests for special causes described by Nelson (1984, 1985). Also see Chapter 48, “Testsfor Special Causes.” Moreover,

� cusum schemes are more complicated to design.

� a cusum chart can be slower to detect large shifts in the process mean.

� it can be difficult to interpret point patterns on a cusum chart since the cusumsare correlated.

Methods for Estimating the Standard Deviation

It is recommended practice to provide a stable estimate or standard value for� witheither the SIGMA0= option or the variable–STDDEV– in a LIMITS= data set. How-ever, if such a value is not available, you can compute an estimate� from the data, asdescribed in this section.

401SAS OnlineDoc: Version 8

Page 44: XCHART Statement

Part 2. The CAPABILITY Procedure

This section provides formulas for various methods used to estimate the standard de-viation�. One method is applicable with individual measurements, and three are ap-plicable with subgrouped data. The methods can be requested with the SMETHOD=option.

Method for Individual MeasurementsWhen the cumulative sums are calculated from individual observations

x1; x2; : : : ; xN

rather than subgroup samples of two or more observations, the CUSUM procedureestimates� as

p�2, where

�2 =1

2(N � 1)

N�1Xi=1

(xi+1 � xi)2

whereN is the number of observations. Wetherill (1977) states that the estimate ofthe variance is biased if the measurements are autocorrelated.

Note that you can compute alternative estimates (for instance, robust estimates orestimates based on variance components models) by analyzing the data with SASmodeling procedures or your own DATA step program. Such estimates can be passedto the CUSUM procedure as values of the variable–STDDEV– in a LIMITS= dataset.

NOWEIGHT Method for Subgroup SamplesThis method is the default for cusum charts for subgrouped data. The estimate is

� =(s1=c4(n1)) + � � � + (sN=c4(nN ))

N

whereni is the sample size of theith subgroup,N is the number of subgroups forwhichni � 2, si is the sample standard deviation of the observationsxi1; : : : ; xini

intheith subgroup.

si =q(1=(ni � 1))

Pni

j=1 (xij � �Xi)2

and

c4(ni) =�(ni=2)

p2=(ni � 1)

�((ni � 1)=2)

where�(�) denotes the gamma function, and�Xi denotes theith subgroup mean. Asubgroup standard deviationsi is included in the calculation only ifni � 2. If theobservations are normally distributed, then the expected value ofsi is

E(si) = c4(ni)�

SAS OnlineDoc: Version 8402

Page 45: XCHART Statement

Chapter 12. Details

Thus, � is the unweighted average ofN unbiased estimates of�. This method isdescribed in theASTM Manual on Presentation of Data and Control Chart Analysis.

MVLUE Method for Subgroup SamplesIf you specify SMETHOD=MVLUE, a minimum variance linear unbiased estimate(MVLUE) is computed, as introduced by Burr (1969, 1976). This estimate is aweighted average of unbiased estimates of� of the form

si=c4(ni)

where

si is the standard deviation of theith subgroup.c4(ni) is the unbiasing factor defined previously.ni is theith subgroup sample size,i = 1; 2; : : : ; N .N is the number of subgroups for whichni � 2.

The estimate is

� =h1s1=c4(n1) + � � �+ hNsN=c4(nN )

h1 + � � � + hN

wherehi = c24(ni)=(1� c24(ni)) . A subgroup standard deviationsi is included in thecalculation only ifni � 2.

The MVLUE assigns greater weight to estimates of� from subgroups with largersample sizes and is intended for situations where the subgroup sample sizes vary. Ifthe subgroup sample sizes are constant, the MVLUE reduces to the default estimate(NOWEIGHT).

RMSDF Method for Subgroup SamplesIf you specify SMETHOD=RMSDF, a weighted root-mean-square estimate is com-puted:

� =

q(n1 � 1)s21 + � � �+ (nN � 1)s2N

c4(n)pn1 + � � � + nN �N

where

ni is the sample size of theith subgroup.N is the number of subgroups for whichni � 2.si is the sample standard deviation of theith subgroup.c4(ni) is the unbiasing factor defined previously.n is equal to(n1 + � � � + nN)� (N � 1) :

The weights in the root-mean-square expression are the degrees of freedomni � 1.A subgroup standard deviationsi is included in the calculation only ifni � 2.

If the unknown standard deviation� is constant across subgroups, the root-mean-square estimate is more efficient than the minimum variance linear unbiased estimate.

403SAS OnlineDoc: Version 8

Page 46: XCHART Statement

Part 2. The CAPABILITY Procedure

However, as noted by Burr (1969), “the constancy of� is the very thing under test,”and if � varies across subgroups, the root-mean-square estimate tends to be moreinflated than the MVLUE.

Output Data Sets

OUTLIMITS= Data SetWhen you save the parameters for the cusum scheme in an OUTLIMITS= data set,the following variables are included:

Table 12.20. OUTLIMITS= Data Set

Variable Description

–ALPHA– probability (�) of Type 1 error

–ARLIN– average run length for zero shift

–ARLOUT– average run length for shift of�

–BETA– probability (�) of Type 2 error

–DELTA– shift (�) to be detected

–H– decision intervalh for one-sided scheme; distanceh between ori-gin and upper arm V-mask for two-sided scheme

–HSTART– headstart value

–INDEX– optional identifier for cusum parameters (if the OUTINDEX= op-tion is specified)

–K– reference valuek for one-sided scheme; slope of lower V-maskarm for two-sided scheme

–LIMITN – nominal sample size for cusum scheme

–MEAN– estimated process mean (X)

–MU0– target mean�0–ORIGIN– origin of V-mask

–SCHEME– type of scheme (ONESIDEDor TWOSIDED)

–SIGMAS– z1��=2

–STDDEV– estimated or known standard deviation (� or �0)

–SUBGRP– subgroup-variablespecified in XCHART statement

–TYPE– type (ESTIMATEor STANDARD) of –STDDEV––VAR– processspecified in XCHART statement

Notes:

1. If the subgroup sample sizes vary, the special missing valueV is assigned tothe variable–LIMITN –.

2. If a V-mask is specified with SIGMAS=k, –ALPHA– is computed as� = 2(1� �(k)), where�(�) is the standard normal distribution function.

3. If a V-mask is specified with ALPHA=�, –SIGMAS– is computed ask = ��1(1 � �=2), where��1 is the inverse standard normal distributionfunction.

4. BY variables are saved in the OUTLIMITS= data set.

SAS OnlineDoc: Version 8404

Page 47: XCHART Statement

Chapter 12. Details

The OUTLIMITS= data set contains one observation for eachprocessspecified inthe XCHART statement. For an example, see “Saving Cusum Scheme Parameters”on page 371.

OUTHISTORY= Data SetWhen you save subgroup summary statistics in an OUTHISTORY= data set, the fol-lowing variables are included:

� thesubgroup-variable� a subgroup mean variable named byprocesssuffixed withX� a subgroup sample size variable named byprocesssuffixed withN� a subgroup standard deviation variable named byprocesssuffixed withS� a cusum variable named byprocesssuffixed withC

Given aprocessthat is eight characters long, the procedure first shortens the prefix toits first four characters and its last three characters and then adds the suffix. For ex-ample, the procedure shortens theprocessDIAMETER to DIAMTER before addingthe suffixes.

Variables containing subgroup summary statistics are created for eachprocessspeci-fied in the XCHART statement. For example, consider the following statements:

proc cusum data=steel limits=stparm;xchart (width diameter)*lot / outhistory=summary;

run;

The data set SUMMARY would contain nine variables named LOT, WIDTHX,WIDTHS, WIDTHN, WIDTHC, DIAMTERX, DIAMTERS, DIAMTERN, and DI-AMTERC.

Additionally, if specified, the following variables are included:

� BY variables� block-variables� symbol-variable� ID variables� –PHASE– (if the OUTPHASE= option is specified)

For an example creating an OUTHISTORY= data set, see “Saving SummaryStatistics” on page 367.

OUTTABLE= Data SetThe OUTTABLE= data set saves subgroup means, subgroup sample sizes, cusums,and cusum limits. The following variables are included:

405SAS OnlineDoc: Version 8

Page 48: XCHART Statement

Part 2. The CAPABILITY Procedure

Variable Description

–CUSUM– cumulative sum

–EXLIM – decision interval or V-mask arm exceeded

–H– decision interval

–MASKL– lower arm of V-mask

–MASKU– upper arm of V-masksubgroup values of the subgroup variable

–SUBN– subgroup sample size

–SUBX– subgroup mean

–SUBS– subgroup standard deviation

–VAR– processspecified in XCHART statement

In addition, the following variables are saved if specified:� BY variables� block-variables� ID variables� –PHASE– (if the READPHASES= option is specified)� –TREND– (if the TRENDVAR= option is specified)� symbol-variable

Note that the variables–VAR– and–EXLIM – are character variables of length eight.The variable–PHASE– is a character variable of length 16.

ODS Tables

The following table summarizes the ODS tables that you can request with theXCHART statement.

Table 12.21. ODS Tables Produced with the XCHART Statement

Table Name Description OptionsCompCusum computational form of the

cusum schemeTABLEALL, TABLECOMP

Parameters cusum parameters and com-puted average run lengths

TABLEALL,TABLESUMMARY

XCHART cusum chart summary statis-tics

TABLEALL, TABLECHART,TABLEOUT

Input Data Sets

DATA= Data SetYou can read raw data (measurements) from a DATA= data set specified in the PROCCUSUM statement. Eachprocessspecified in the XCHART statement must be aSAS variable in the DATA= data set. The values of this variable are typically mea-surements of a quality characteristic taken on items in subgroup samples indexed bythe values of the subgroup variable. Thesubgroup-variablespecified in the XCHARTstatement must also be a SAS variable in the DATA= data set. Other variables thatcan be read from a DATA= data set include

SAS OnlineDoc: Version 8406

Page 49: XCHART Statement

Chapter 12. Details

� –PHASE– (if the READPHASES= option is specified)� block-variables� symbol-variable� BY variables� ID variables

Each observation in a DATA= data set should contain a raw measurement for eachprocessand a value for the subgroup variable. If theith subgroup containsni items,there should beni consecutive observations for which the value of the subgroup vari-able is the index of theith subgroup. For example, if each of 30 subgroup samplescontains five items, the DATA= data set should contain 150 observations.

By default, the CUSUM procedure reads all of the observations in a DATA= dataset. However, if the DATA= data set includes the variable–PHASE–, you can readselected groups of observations (referred to asphases) by specifying the READ-PHASES= option in the XCHART statement.

For an example of a DATA= data set, see “Creating a V-Mask Cusum Chart fromRaw Data” on page 362.

LIMITS= Data SetYou can read cusum scheme parameters from a LIMITS= data set specified in thePROC CUSUM statement.� As an alternative to specifying the parameters with op-tions, a LIMITS= data set provides the following advantages: it facilitates reusinga permanently saved set of parameters, reading a distinct set of parameters for eachprocessspecified in the XCHART statement, and keeping track of multiple sets ofparameters for the sameprocessover time.

The LIMITS= data set can be an OUTLIMITS= data set that was created in a previousrun of the CUSUM procedure. Such data sets always contain the variables requiredfor a LIMITS= data set; consequently, this is the easiest way to construct a LIMITS=data set.

A LIMITS= data set can also be created directly using a DATA step. The variablesrequired for the data set depend on the type of cusum scheme and how the scheme isspecified. The following restrictions apply:

� The variables–VAR–, –SUBGRP–, –DELTA–, and–MU0– are required.

� For a one-sided cusum scheme,–H– is required.

� For a two-sided cusum scheme, one of the following three variables is required:

–ALPHA–, –H–, or –SIGMAS–.

� If you plan to use the READINDEX= option, the variable–INDEX– is re-quired; otherwise, it is optional.

� For a one-sided scheme, the variable–SCHEME– is required; otherwise, it isoptional.

� If you want to provide a value for the process standard deviation�, the variable

–STDDEV– is required; otherwise, it is optional.

�If you are using Release 6.09 or an earlier release, you must also specify the READLIMITS orREADINDEX= option in the XCHART statement.

407SAS OnlineDoc: Version 8

Page 50: XCHART Statement

Part 2. The CAPABILITY Procedure

Variable names in a LIMITS= data set are predefined; the procedure reads only vari-ables with these predefined names. With the exception of BY variables, all namesstart and end with an underscore. In addition, note the following:

� The variables–VAR–, –SUBGRP–, –TYPE–, and–SCHEME– must be char-acter variables of length eight. The variable–INDEX– must be a charactervariable of length 16.

� The variable–TYPE– is a bookkeeping variable that uses the valuesESTI-MATEandSTANDARDto record whether the value of–STDDEV– representsan estimate or standard (known) value.

� BY variables are required if specified with a BY statement.

For an example of reading control limit information from a LIMITS= data set, see“Reading Cusum Scheme Parameters” on page 373.

HISTORY= Data SetInstead of reading raw data from a DATA= data set, you can read subgroup summarystatistics from a HISTORY= data set specified in the PROC CUSUM statement. Thisallows you to reuse OUTHISTORY= data sets that have been created in previousruns of the CUSUM, MACONTROL, or SHEWHART procedures or to read outputdata sets created with SAS summarization procedures such as PROC MEANS. AHISTORY= data set must contain the following variables:

� subgroup-variable� subgroup mean variable for eachprocess� subgroup standard deviation variable for eachprocess� subgroup sample size variable for eachprocess

The names of the subgroup mean, subgroup standard deviation, and subgroup samplesize variables must be theprocessconcatenated with the special suffix charactersX,S, andN respectively.

For example, consider the following statements:

proc cusum history=steel limits=stlparm;xchart (weight yldstren)*batch;

run;

The data set STEEL must contain the variables BATCH, WEIGHTX, WEIGHTS,WEIGHTN, YLDSRENX, YLDSRENS, and YLDSRENN.

Note that if you specify aprocessthat is eight characters long, the procedure uses aprefix formed from the first four characters and the last three characters of theprocess.

Other variables that can be read from a HISTORY= data set include

� –PHASE– (if the READPHASES= option is specified)� block-variables� symbol-variable� BY variables� ID variables

SAS OnlineDoc: Version 8408

Page 51: XCHART Statement

Chapter 12. Details

By default, the CUSUM procedure reads all of the observations in a HISTORY=data set. However, if the HISTORY= data set includes the variable–PHASE–, youcan read selected groups of observations (referred to as phases) by specifying theREADPHASES= option.

For an example of reading summary information from a HISTORY= data set, see“Creating a V-Mask Cusum Chart from Subgroup Summary Data” on page 365.

Missing Values

An observation read from a DATA= or HISTORY= data set is not analyzed if thevalue of the subgroup variable is missing. For a particular process variable, an obser-vation read from a DATA= data set is not analyzed if the value of the process variableis missing. Missing values of process variables generally lead to unequal subgroupsample sizes. For a particular process variable, an observation read from a HIS-TORY= data set is not analyzed if the values of any of the corresponding summaryvariables are missing.

409SAS OnlineDoc: Version 8

Page 52: XCHART Statement

Part 2. The CAPABILITY Procedure

Examples

This section provides advanced examples of the XCHART statement.

Example 12.1. Cusum and Standard Deviation Charts

When you are working with subgrouped data, it can be helpful to accompany a cusumSee CUSXSin the SAS/QCSample Library

chart for means with a Shewharts 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” on page 362).

The first step is to create a one-sided cusum chart for means that detects a shift of onestandard error (� = �1) 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 cusumvariable (–CUSUM–) and the decision interval variable (–H–) are renamed to

–SUBX– and–LCLX– so that they can later be read by the SHEWHART proce-dure.

The next step is to construct a Shewhart�X ands chart for WEIGHT and save theresults 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.

SAS OnlineDoc: Version 8410

Page 53: XCHART Statement

Chapter 12. Examples

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, andthe variable–MEAN– is assigned a dummy value. Now, TABALL, which is listedin Output 12.1.1, has the structure required for a TABLE= data set used with theXSCHART statement in the SHEWHART procedure (see “TABLE= Data Set” onpage 1580 in Chapter 44, “XSCHART Statement”).

Output 12.1.1. Listing of the Data Set TABALL

_ _ _S L _ EI I _ _ _ E _ _ _ X _ _

_ G M S L M X L S U L s uV h M I U C E L C U C I u c

O A o A T B L A I L B _ L M b lb R u S N N X N M S S S S S x xs _ r _ _ _ _ _ _ _ _ _ _ _ _ _

1 weight 1 3 4 4 0 1.5 0 0.059640 0.049943 0.11317 0.00 32 weight 2 3 4 4 0 1.5 0 0.090220 0.049943 0.11317 0.00 33 weight 3 3 4 4 0 1.5 0 0.076346 0.049943 0.11317 0.00 34 weight 4 3 4 4 0 1.5 0 0.025552 0.049943 0.11317 0.00 35 weight 5 3 4 4 0 1.5 0 0.026500 0.049943 0.11317 0.00 36 weight 6 3 4 4 0 1.5 0 0.075617 0.049943 0.11317 0.30 37 weight 7 3 4 4 0 1.5 0 0.037242 0.049943 0.11317 0.00 38 weight 8 3 4 4 0 1.5 0 0.059290 0.049943 0.11317 0.18 39 weight 9 3 4 4 0 1.5 0 0.005737 0.049943 0.11317 1.21 3

10 weight 10 3 4 4 0 1.5 0 0.046522 0.049943 0.11317 0.62 311 weight 11 3 4 4 0 1.5 0 0.040542 0.049943 0.11317 0.00 312 weight 12 3 4 4 0 1.5 0 0.056103 0.049943 0.11317 0.00 3

The final step is to use the SHEWHART procedure to read TABALL as a TABLE=data set and to display the cusum ands charts.

title ’Cusum Chart for Mean and s chart’;symbol v=dot;proc shewhart table=taball;

xschart weight * hour /ucllabel = ’h=3.0’nolimitslegendnoctlsplit = ’/’nolegend ;

label _subx_ = ’Lower Cusum/Std Dev’;run;

411SAS OnlineDoc: Version 8

Page 54: XCHART Statement

Part 2. The CAPABILITY Procedure

The central line for the primary (cusum) chart is suppressed with the NOCTL option,and the default3� 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 Chart

The process variability is stable, and there is no signal of a downward shift in theprocess mean.

SAS OnlineDoc: Version 8412

Page 55: XCHART Statement

Chapter 12. Examples

Example 12.2. Upper and Lower One-Sided Cusum Charts

This example illustrates how to combine upper and lower one-sided cusum charts forSee CUSUPLOin the SAS/QCSample Library

means in the same display. As in the preceding example, OUTTABLE= data sets arecreated with the CUSUM procedure, and the display is created with the SHEWHARTprocedure.

The following statements analyze the variable WEIGHT in the data set OIL (see“Creating a V-Mask Cusum Chart from Raw Data” on page 362). The first step is tocompute and save upper and lower one-sided cusums for shifts of one standard errorin the positive and negative directions.

proc cusum data=oil;xchart weight*hour /

nochartmu0 = 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=onesidedouttable = tabupper

( drop = _subx_ _subs_ _exlim_rename = ( _cusum_ = _subx_ _h_ = _uclx_ ) )

;xchart weight*hour /

nochartmu0 = 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=onesidedouttable = 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 thecusums, and the variables–MEAN– and –S– are assigned dummy values. Now,

413SAS OnlineDoc: Version 8

Page 56: XCHART Statement

Part 2. The CAPABILITY Procedure

TABBOTH has the structure required for a TABLE= data set used with theXSCHART statement in the SHEWHART procedure (see “TABLE= Data Set” onpage 1580 in Chapter 44, “XSCHART Statement”).

The final step is to read TABBOTH as a TABLE= data set with the SHEWHARTprocedure.

title ’Upper and Lower Cusums’;symbol v=dot;proc shewhart table=tabboth;

xschart weight*hour /nolimitslegenducllabel = ’h=3.0’ucllabel2 = ’h=3.0’ypct1 = 50vref = 1 2vref2 = 1 2lvref = 2noctlnoctl2split = ’/’nolegend ;

label _subx_ = ’Upper Sum/Lower Sum’;run;

The combined display is shown in Output 12.2.1. There is no evidence of a shift ineither direction.

Output 12.2.1. Upper and Lower One-Sided Cusum Charts

SAS OnlineDoc: Version 8414

Page 57: XCHART Statement

Chapter 12. Examples

Example 12.3. Combined Shewhart–Cusum Scheme

Lucas (1982) introduced a combined Shewhart-cusum scheme that is illustrated inSee CUSCOMBin the SAS/QCSample Library

this example. Also refer to Ryan (1989). The data set used here is CANS, which iscreated in “Creating a One-Sided Cusum Chart with a Decision Interval” on page 368.

The first step is to compute and save one-sided cusums to detect a positive shift fromthe mean.

proc cusum data=cans;xchart weight*hour /

nochartmu0 = 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 /* onesided scheme */outtable = tabcus /* save the result} */

( drop = _var_ _subn_ _exlim_rename = ( _cusum_ = _subr_ _h_ = _uclr_ ) )

;run;

Note that a headstart value is not used here but can be specified with the HSTART=option. Several variables in the OUTTABLE= data set are dropped or renamed sothat they can later be read by the SHEWHART procedure.

The next step is to construct a Shewhart chart (not shown) for individual measure-ments.

proc shewhart data=cans;irchart weight*hour /

nochartmu0 = 8.100sigma0 = 0.050outtable = tabx

( drop = _subr_ _lclr_ _r_ _uclr_ );id comment;

run;

By default,3� limits are computed, but the multiple of� can be modified with theSIGMAS= option. As before, the results are saved in an OUTTABLE= data set.

Next, the two OUTTABLE= data sets are merged.

data combine;merge tabx tabcus; by hour;_lclr_ = 0.0;_r_ = 0.5 * _uclr_;

run;

415SAS OnlineDoc: Version 8

Page 58: XCHART Statement

Part 2. The CAPABILITY Procedure

The data set COMBINE has the structure required for a TABLE= data set used withthe IRCHART statement in the SHEWHART procedure (see “TABLE= Data Set” onpage 1171 in Chapter 34, “IRCHART Statement”).

Finally, the combined scheme is displayed with the SHEWHART procedure.

symbol v=dot;title ’Combined Shewhart-Cusum Analysis for Weight’;proc shewhart table=combine;

irchart weight*hour /ypct1 = 50noctl2ucllabel2 = ’h=0.3’outlabel = ( comment )outlabel2 = ( comment )cframelab = ligrsplit = ’/’;

label _subi_ = ’Shewhart/Cusum’;run;

The chart is shown in Output 12.3.1.

Output 12.3.1. Combined Shewhart–Cusum Scheme

Note that a shift is detected by the cusum scheme but not by the Shewhart chart. Thepoint exceeding the decision interval is labeled with the variable COMMENT createdin the data set CANS.

Lucas (1982) tabulates average run lengths for combined Shewhart-cusum schemes.The scheme used here has an ARL of 111.1 for� = 0 and an ARL of 6.322 for� = 1.

SAS OnlineDoc: Version 8416

Page 59: XCHART Statement

The correct bibliographic citation for this manual is as follows: SAS Institute Inc.,SAS/QC ® User’s Guide, Version 8, Cary, NC: SAS Institute Inc., 1999. 1994 pp.

SAS/QC® User’s Guide, Version 8Copyright © 1999 SAS Institute Inc., Cary, NC, USA.ISBN 1–58025–493–4All rights reserved. Printed in the United States of America. No part of this publicationmay be reproduced, stored in a retrieval system, or transmitted, by any form or by anymeans, electronic, mechanical, photocopying, or otherwise, without the prior writtenpermission of the publisher, SAS Institute Inc.U.S. Government Restricted Rights Notice. Use, duplication, or disclosure of thesoftware by the government is subject to restrictions as set forth in FAR 52.227–19Commercial Computer Software-Restricted Rights (June 1987).SAS Institute Inc., SAS Campus Drive, Cary, North Carolina 27513.1st printing, October 1999SAS® and all other SAS Institute Inc. product or service names are registered trademarksor trademarks of SAS Institute in the USA and other countries.® indicates USAregistration.IBM®, ACF/VTAM®, AIX®, APPN®, MVS/ESA®, OS/2®, OS/390®, VM/ESA®, and VTAM®

are registered trademarks or trademarks of International Business Machines Corporation.® indicates USA registration.Other brand and product names are registered trademarks or trademarks of theirrespective companies.The Institute is a private company devoted to the support and further development of itssoftware and related services.