Selecting Subgroups Using WHERE Statements

/****************************************************************/
/*          S A S   S A M P L E   L I B R A R Y                 */
/*                                                              */
/*    NAME: SHWWHR                                              */
/*   TITLE: Selecting Subgroups Using WHERE Statements          */
/* PRODUCT: QC                                                  */
/*  SYSTEM: ALL                                                 */
/*    KEYS: Shewhart Charts,                                    */
/*   PROCS: SHEWHART                                            */
/*    DATA:                                                     */
/*                                                              */
/*     REF: SAS/QC Software:  Usage and Reference, Version 6,   */
/*          First Edition, Volume 1 and Volume 2                */
/*                                                              */
/****************************************************************/

data Bottles;
   informat Day date7.;
   format Day date7.;
   nBottles = 3000;
   input Day nCracks @@;
   datalines;
04JAN94  61  05JAN94  56  06JAN94  71  07JAN94  56
10JAN94  51  11JAN94  64  12JAN94  71  13JAN94  91
14JAN94  98  17JAN94  68  18JAN94  63  19JAN94  60
20JAN94  58  21JAN94  55  24JAN94  78  25JAN94  47
26JAN94  54  27JAN94  69  28JAN94  73  31JAN94  66
01FEB94  57  02FEB94  55  03FEB94  63  04FEB94  50
07FEB94  69  08FEB94  54  09FEB94  64  10FEB94  66
11FEB94  70  14FEB94  49  15FEB94  57  16FEB94  56
17FEB94  59  18FEB94  66  21FEB94  60  22FEB94  58
23FEB94  67  24FEB94  60  25FEB94  62  28FEB94  48
;


ods graphics on;
title 'Preliminary Analysis of January Production';
proc shewhart data=Bottles;
   where Day <= '31JAN94'D;
   pchart nCracks * Day / subgroupn = nBottles
                          nohlabel
                          nolegend
                          markers
                          odstitle  = title
                          outlimits = mylim;
   label nCracks = 'Proportion With Cracks';
run;

title 'Final Analysis of January Production';
proc shewhart data=Bottles;
   where ( Day <= '31JAN94'D ) &
         ( Day ne '13JAN94'D ) &
         ( Day ne '14JAN94'D )   ;
   pchart nCracks * Day / subgroupn = nBottles
                          nohlabel
                          nolegend
                          markers
                          odstitle  = title
                          outlimits = Janlim;
   label nCracks = 'Proportion With Cracks';
run;

proc print data=Janlim noobs;
run;

title 'Analysis of February Production';
proc shewhart data=Bottles limits=Janlim;
   where Day > '31JAN94'D;
   pchart nCracks * Day / subgroupn = nBottles
                          odstitle  = title
                          nolegend
                          nohlabel;
   label nCracks = 'Proportion With Cracks';
run;