Shewhart p Chart With Block Variables
/****************************************************************/
/* S A S S A M P L E L I B R A R Y */
/* */
/* NAME: SHWBLK1 */
/* TITLE: Shewhart p Chart With Block Variables */
/* PRODUCT: QC */
/* SYSTEM: ALL */
/* KEYS: Shewhart Charts, p Charts, */
/* PROCS: SHEWHART */
/* DATA: */
/* */
/* REF: SAS/QC Software: Examples */
/* */
/****************************************************************/
options ps=60 ls=80 nodate;
data a;
length training $ 16 ;
length ctrain $ 8 ;
nsample = 200;
do hour = 1 to 10;
training = 'Expert';
ctrain = 'dagr';
defects = ranbin( 53499, nsample, 0.02 );
output;
end;
do hour = 11 to 20;
training = 'Novice';
ctrain = 'grey';
defects = ranbin( 53499, nsample, 0.08 );
output;
end;
do hour = 21 to 30;
training = 'Expert' ;
ctrain = 'dagr' ;
defects = ranbin( 53499, nsample, 0.04 );
output;
end;
run;
data a;
length air $ 16 cair $ 8;
set a;
if hour >= 19 then do;
air = 'Off';
cair = 'red';
end;
else do;
air = 'On';
cair = 'blue';
end;
run;
symbol1 v=dot h=.75 c=white;
title 'p Chart For Proportion Defective';
proc shewhart data=a;
pchart defects * hour /
nolegend
novangle
subgroupn = nsample
cframe = gray
cinfill = blue ;
label hour = 'Hour'
defects = 'Proportion Defective';
run;
title 'Does Training Make A Difference?';
proc shewhart data=a;
pchart defects * hour (training) /
nolegend
novangle
subgroupn = nsample
cframe = gray
cinfill = blue ;
label hour = 'Hour'
defects = 'Proportion Defective';
run;
title 'Does Training Make A Difference?';
proc shewhart data=a;
pchart defects * hour (training) /
nolegend
novangle
subgroupn = nsample
cframe = gray
cinfill = blue ;
label hour = 'Hour'
training = 'Operator skill level:'
defects = 'Proportion Defective';
run;
title 'Does Air Conditioning Help?';
proc shewhart data=a;
pchart defects * hour (training air) /
nolegend
novangle
subgroupn = nsample
cframe = gray
cinfill = blue ;
label hour = 'Hour'
training = 'Operator skill level:'
air = 'Air conditioning:'
defects = 'Proportion Defective';
run;
title 'Does Air Conditioning Help?';
proc shewhart data=a;
pchart defects * hour (training air) /
blockpos = 4
nolegend
novangle
subgroupn = nsample
cframe = gray
cinfill = blue ;
label hour = 'Hour'
training = 'Operator skill level:'
air = 'Air conditioning:'
defects = 'Proportion Defective';
run;
goptions reset=all;