Exponentially Wghtd Moving Averages Table

 /****************************************************************/
 /*          S A S   S A M P L E   L I B R A R Y                 */
 /*                                                              */
 /*    NAME: MACEWMA2                                            */
 /*   TITLE: Exponentially Wghtd Moving Averages Table           */
 /* PRODUCT: QC                                                  */
 /*  SYSTEM: ALL                                                 */
 /*    KEYS: Moving Average Charts, EWMA Charts,                 */
 /*   PROCS: MACONTROL                                           */
 /*    DATA:                                                     */
 /*                                                              */
 /*     REF: SAS/QC Software:  Examples                          */
 /*    MISC:                                                     */
 /*                                                              */
 /****************************************************************/

options nodate nostimer nonumber source2 ls=120 ps=80;

data clips3;
   input day @ ;
   do i=1 to 5;
      input gap @ ;
      output;
      end;
   drop i;
   cards;
 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.67  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.80  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
;

title 'EWMA Analysis of Gap Data in CLIPS3';

proc macontrol data=clips3;
   ewmachart gap*day='x' /
      mu0   =15.0               /* Known mean                  */
      sigma0=0.2                /* Known standard deviation    */
      weight=0.5                /* Weight parameter            */
      nochart                   /* Suppresses chart            */
      tableall;                 /* Tabulates EWMAs and limits  */
run;


proc macontrol data=clips3;
   ewmachart gap*day='x' /
      mu0   =15.0               /* Known mean                   */
      sigma0=0.2                /* Known standard deviation     */
      weight=0.5                /* Weight parameter             */
      nochart                   /* Suppresses chart             */
      tableall(ex noprint)      /* Table for exceptional values */
      outtable=ewmatab;
run;

title1 'Out-of-Control Signals in EWMA Analysis of Clip Gap';
title2 '3-Sigma Limits with WEIGHT=0.5 and n=5';
proc print label split='/' data=ewmatab;
   var _subx_ _lcle_ _ewma_ _ucle_ _exlim_;
   id day;
   label _subx_   = 'Subgroup/Mean'
         _lcle_   = 'Lower Limit/for EWMA'
         _ewma_   = 'EWMA'
         _ucle_   = 'Upper Limit/for EWMA'
         _exlim_  = 'Limit Exceeded/by EWMA';
run;

title;