Selecting Subgroups Using Switch Variables
/****************************************************************/
/* S A S S A M P L E L I B R A R Y */
/* */
/* NAME: SHWSVAR */
/* TITLE: Selecting Subgroups Using Switch Variables */
/* 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
;
data Bottles;
length _comp_ _disp_ $ 1;
set Bottles;
if Day = '13JAN94'D then _comp_ = 'n';
else if Day = '14JAN94'D then _comp_ = 'n';
else if Day <= '31JAN94'D then _comp_ = 'y';
else _comp_ = 'n';
if Day <= '31JAN94'D then _disp_ = 'n';
else _disp_ = 'y';
run;
ods graphics on;
title 'Analysis of February Production';
proc shewhart data=Bottles;
pchart nCracks * Day / subgroupn = nBottles
odstitle = title
markers
nolegend
nohlabel;
label nCracks = 'Proportion With Cracks';
run;