Resources

Moving Averages Computed from Summary Data

 /****************************************************************/
 /*          S A S   S A M P L E   L I B R A R Y                 */
 /*                                                              */
 /*    NAME: MACUWMA4                                            */
 /*   TITLE: Moving Averages Computed from Summary Data          */
 /* PRODUCT: QC                                                  */
 /*  SYSTEM: ALL                                                 */
 /*    KEYS: Moving Average Charts,                              */
 /*   PROCS: MACONTROL                                           */
 /*    DATA:                                                     */
 /*                                                              */
 /*     REF: SAS/QC Software:  Examples                          */
 /*    MISC: If you are using a monochrome graphics device,      */
 /*          eliminate the CINFILL option.                       */
 /*          The limits data set MAPARMS is created in the       */
 /*          program MACUWMA2 in the SAS/QC Sample Library.      */
 /*                                                              */
 /****************************************************************/

options ps=60 ls=80;

data maparms;
  _VAR_    = 'GAP';
  _SUBGRP_ = 'DAY';
  _TYPE_   = 'STANDARD';
  _ALPHA_  =  .0026998;
  _SIGMAS_ =  3;
  _MEAN_   =  15;
  _STDDEV_ =  0.2;
  _SPAN_   =  3;
  run;

data clips4;
   input day @;
   do i=1 to 5;
      input gap @;
      output;
      end;
   informat day ddmmyy8.;
   format   day date5.;
   drop i;
   cards;
 1/4/86  14.93  14.65  14.87  15.11  15.18
 2/4/86  15.06  14.95  14.91  15.14  15.41
 3/4/86  14.90  14.90  14.96  15.26  15.18
 4/4/86  15.25  14.57  15.33  15.38  14.89
 7/4/86  14.68  14.63  14.72  15.32  14.86
 8/4/86  14.48  14.88  14.98  14.74  15.48
 9/4/86  14.99  15.16  15.02  15.53  14.66
10/4/86  14.88  15.44  15.04  15.10  14.89
11/4/86  15.14  15.33  14.75  15.23  14.64
14/4/86  15.46  15.30  14.92  14.58  14.68
15/4/86  15.23  14.63    .      .      .
16/4/86  15.13  15.25    .      .      .
17/4/86  15.06  15.25  15.28  15.30  15.34
18/4/86  15.22  14.77  15.12  14.82  15.29
21/4/86  14.95  14.96  14.65  14.87  14.77
22/4/86  15.01  15.11  15.11  14.79  14.88
23/4/86  14.97  15.50  14.93  15.13  15.25
24/4/86  15.23  15.21  15.31  15.07  14.97
25/4/86  15.08  14.75  14.93  15.34  14.98
28/4/86  15.07  14.86  15.42  15.47  15.24
29/4/86  15.27  15.20  14.85  15.62  14.67
30/4/86  14.97  14.73  15.09  14.98  14.46
;

proc macontrol limits=maparms data=clips4 lineprinter;
   machart gap*day /
      readlimits
      outhistory=summary
      nochart;
run;


title1 'Uniformly Weighted Moving Average Chart';
title2 'for Data in CLIPS4 with LIMITN=VARYING';
symbol1 v=dot h=0.75 c=white;

proc macontrol limits=maparms history=summary;
   machart gap*day /
      readlimits
      limitn   = varying
      xsymbol  = mu0
      cinfill  = green
      cconnect = white
      cframe   = gray
      hoffset  = 1.5
      novangle
      nohlabel;
   label gapx='Moving Avg of Clip Gap';
run;

goptions reset=all;