Resources

Two-sided Cusum Chart with V-Mask

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

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.065
 2  7.971  8.165  8.077  8.157
 3  8.125  8.031  8.198  8.050
 4  8.123  8.107  8.154  8.095
 5  8.068  8.093  8.116  8.128
 6  8.177  8.011  8.102  8.030
 7  8.129  8.060  8.125  8.144
 8  8.072  8.010  8.097  8.153
 9  8.066  8.067  8.055  8.059
10  8.089  8.064  8.170  8.086
11  8.058  8.098  8.114  8.156
12  8.147  8.116  8.116  8.018
;


proc print data=Oil(obs=14) noobs;
run;

ods graphics off;
title 'Cusum Chart for Average Weights of Cans';
proc cusum data=Oil;
   xchart Weight*Hour /
      mu0    = 8.100           /* Target mean for process  */
      sigma0 = 0.050           /* Known standard deviation */
      delta  = 1               /* Shift to be detected     */
      alpha  = 0.10            /* Type I error probability */
      vaxis  = -5 to 3 ;
   label Weight = 'Cumulative Sum';
run;

data Oilstat;
   label Hour = 'Hour';
   input Hour WeightX WeightS WeightN;
   datalines;
 1  8.0938  0.0596  4
 2  8.0925  0.0902  4
 3  8.1010  0.0763  4
 4  8.1198  0.0256  4
 5  8.1013  0.0265  4
 6  8.0800  0.0756  4
 7  8.1145  0.0372  4
 8  8.0830  0.0593  4
 9  8.0618  0.0057  4
10  8.1023  0.0465  4
11  8.1065  0.0405  4
12  8.0993  0.0561  4
;

title;
proc print data=Oilstat;
run;

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;

title 'Cusum Chart for Average Weights of Cans';
proc cusum data=Oil;
   xchart Weight*Hour /
      nochart
      outhistory = Oilhist
      mu0        = 8.100        /* Target mean for process  */
      sigma0     = 0.050        /* Known standard deviation */
      delta      = 1            /* Shift to be detected     */
      alpha      = 0.10         /* Type I error probability */
      vaxis      = -5 to 3 ;
   label Weight = 'Cumulative Sum';
run;

proc print data=Oilhist;
   format WeightX WeightS Weightc 6.4;
run;