See MACEW1 in the SAS/QC Sample LibraryIn the manufacture of a metal clip, the gap between the ends of the clip is a critical dimension. To monitor the process for
a change in the average gap, subgroup samples of five clips are selected daily. The data are analyzed with an EWMA chart.
The gaps recorded during the first twenty days are saved in a SAS data set named Clips1
.
data Clips1; input Day @ ; do i=1 to 5; input Gap @ ; output; end; drop i; datalines; 1 14.76 14.82 14.88 14.83 15.23 2 14.95 14.91 15.09 14.99 15.13 3 14.50 15.05 15.09 14.72 14.97 4 14.91 14.87 15.46 15.01 14.99 5 14.73 15.36 14.87 14.91 15.25 6 15.09 15.19 15.07 15.30 14.98 7 15.34 15.39 14.82 15.32 15.23 8 14.80 14.94 15.15 14.69 14.93 9 14.67 15.08 14.88 15.14 14.78 10 15.27 14.61 15.00 14.84 14.94 11 15.34 14.84 15.32 14.81 15.17 12 14.84 15.00 15.13 14.68 14.91 13 15.40 15.03 15.05 15.03 15.18 14 14.50 14.77 15.22 14.70 14.80 15 14.81 15.01 14.65 15.13 15.12 16 14.82 15.01 14.82 14.83 15.00 17 14.89 14.90 14.60 14.40 14.88 18 14.90 15.29 15.14 15.20 14.70 19 14.77 14.60 14.45 14.78 14.91 20 14.80 14.58 14.69 15.02 14.85 ;
A partial listing of Clips1
is shown in Figure 9.2.
Figure 9.2: Partial Listing of the Data Set Clips1
The Data Set Clips1 
Day  Gap 

1  14.76 
1  14.82 
1  14.88 
1  14.83 
1  15.23 
2  14.95 
2  14.91 
2  15.09 
2  14.99 
2  15.13 
3  14.50 
3  15.05 
3  15.09 
3  14.72 
3  14.97 
The data set Clips1
is said to be in “strungout” form, since each observation contains the day and gap measurement of a single clip. The first five observations contain the
gap measurements for the first day, the second five observations contain the gap measurements for the second day, and so on.
Because the variable Day
classifies the observations into rational subgroups, it is referred to as the subgroupvariable. The variable Gap
contains the gap measurements and is referred to as the process variable (or process for short).
The withinsubgroup variability of the gap measurements is known to be stable. You can use an EWMA chart to determine whether the mean level is in control. The following statements create the EWMA chart shown in Figure 9.3:
ods graphics off; symbol h = 0.8; title 'EWMA Chart for Gap Measurements'; proc macontrol data=Clips1; ewmachart Gap*Day / weight=0.3; run;
This example illustrates the basic form of the EWMACHART statement. After the keyword EWMACHART, you specify the process to analyze (in this case, Gap
) followed by an asterisk and the subgroupvariable (Day
). The WEIGHT= option specifies the weight parameter used to compute the EWMAs. Options such as WEIGHT= are specified after the
slash (/) in the EWMACHART statement. A complete list of options is presented in the section Syntax: EWMACHART Statement. You must provide the weight parameter to create an EWMA chart. As an alternative to specifying the WEIGHT= option, you can
read the weight parameter from an input data set; see Reading Preestablished Control Limit Parameters.
The input data set is specified with the DATA= option in the PROC MACONTROL statement.
Figure 9.3: Exponentially Weighted Moving Average Chart
Each point on the chart represents the EWMA for a particular day. The EWMA plotted at Day
=1 is the weighted average of the overall mean and the subgroup mean for Day
=1. The EWMA plotted at Day
=2 is the weighted average of the EWMA and the subgroup mean for Day
=2.






For succeeding days, the EWMA is the weighted average of the previous EWMA and the present subgroup mean. In the example, a weight parameter of 0.3 is used (since WEIGHT=0.3 is specified in the EWMACHART statement).
Note that the EWMA for the th day lies above the upper control limit, signaling an outofcontrol process.
By default, the control limits shown are limits estimated from the data; the formulas for the limits are given in Table 9.3.
For computational details, see Constructing EWMA Charts. For more details on reading from a DATA= data set, see DATA= Data Set.