Resources

One-sided Cusum Chart

/****************************************************************/
/*          S A S   S A M P L E   L I B R A R Y                 */
/*                                                              */
/*    NAME: CUSONES1                                            */
/*   TITLE: One-sided Cusum Chart                               */
/* PRODUCT: QC                                                  */
/*  SYSTEM: ALL                                                 */
/*    KEYS: Cusum Charts,                                       */
/*   PROCS: CUSUM                                               */
/*    DATA:                                                     */
/* SUPPORT: saswgr                                              */
/*     REF: PROC CUSUM, XCHART Statement, Getting Started 1     */
/*                                                              */
/****************************************************************/

data Cans;
   length comment $16;
   label Hour = 'Hour';
   input Hour Weight comment $16. ;
   datalines;
 1  8.024
 2  7.971
 3  8.125
 4  8.123
 5  8.068
 6  8.177  Pump Adjusted
 7  8.229  Pump Adjusted
 8  8.072
 9  8.066
10  8.089
11  8.058
12  8.147
13  8.141
14  8.047
15  8.125
;



ods graphics off;
options nogstyle;
goptions ftext='albany amt';
symbol v=dot color=salmon h=1.8 pct;
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                       */
      cinfill  = ywh
      cframe   = bigb
      cout     = salmon
      cconnect = salmon
      climits  = black
      coutfill = bilg;
   label Weight = 'Cusum of Weight';
run;
options gstyle;

ods graphics on;
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 */
      outlimits = cusparm
      odstitle  = title
      markers;
   label Weight = 'Cusum of Weight';
run;

proc print data=cusparm;
run;

data Cans2;
   length pump $ 8;
   label Hour = 'Hour';
   input Hour Weight pump $ 8. ;
   datalines;
16  8.1765  Pump 3
17  8.0949  Pump 3
18  8.1393  Pump 3
19  8.1491  Pump 3
20  8.0473  Pump 1
21  8.1602  Pump 1
22  8.0633  Pump 1
23  8.0921  Pump 1
24  8.1573  Pump 1
25  8.1304  Pump 1
26  8.0979  Pump 1
27  8.2407  Pump 1
28  8.0730  Pump 1
29  8.0986  Pump 2
30  8.0785  Pump 2
31  8.2308  Pump 2
32  8.0986  Pump 2
33  8.0782  Pump 2
34  8.1435  Pump 2
35  8.0666  Pump 2
;

title "One-Sided Cusum Analysis for New Data";
proc cusum data=Cans2 limits=cusparm;
   xchart Weight*Hour( pump ) / odstitle=title markers;
   label Weight = 'Cusum of Weight';
run;