Resources

Combined Shewhart-Cusum Scheme

/****************************************************************/
/*          S A S   S A M P L E   L I B R A R Y                 */
/*                                                              */
/*    NAME: CUSCOMB                                             */
/*   TITLE: Combined Shewhart-Cusum Scheme                      */
/* PRODUCT: QC                                                  */
/*  SYSTEM: ALL                                                 */
/*    KEYS: Cusum Charts, Shewhart Charts,                      */
/*   PROCS: CUSUM SHEWHART                                      */
/*    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
;



proc cusum data=Cans;
   xchart Weight*Hour /
      nochart
      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
      outtable = Tabcus
         ( drop   = _var_ _subn_ _exlim_
           rename = ( _cusum_ = _subr_ _h_ = _uclr_ ) )
      ;
run;

proc shewhart data=Cans;
   irchart Weight*Hour /
      nochart
      mu0      = 8.100
      sigma0   = 0.050
      outtable = Tabx
         ( drop   = _subr_  _lclr_ _r_ _uclr_ );
   id comment;
run;

data Combine;
   merge Tabx Tabcus; by Hour;
   _lclr_ = 0.0;
   _r_    = 0.5 * _uclr_;
run;

ods graphics on;
title "Combined Shewhart-Cusum Analysis for Weight";
proc shewhart table=Combine;
   irchart Weight*Hour /
      odstitle  = title
      ypct1     = 50
      noctl2
      markers
      ucllabel2 = 'h=0.3'
      outlabel  = ( comment )
      outlabel2 = ( comment )
      split     = '/';
   label _subi_ = 'Shewhart/Cusum';
run;