Chapter Contents 
Previous 
Next 
Graphical Enhancements 
See SHWWHR in the SAS/QC Sample Library 
The following statements create a data set named BOTTLES that records the number of cracked bottles encountered each day during two months (January and February) of a soft drink bottling operation:
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 ;
The variable NBOTTLES contains the number of bottles sampled each day, and the variable NCRACKS contains the number of cracked bottles in each sample.
The following statements create a p chart for the number of cracked bottles based on the January production:
title 'Preliminary Analysis of January Production'; symbol v=dot c=salmon; proc shewhart data=bottles; where day <= '31JAN94'D; pchart ncracks * day / subgroupn = nbottles nohlabel nolegend outlimits = mylim cframe = vibg cinfill = ywh coutfill = ligr cconnect = salmon; label ncracks = 'Proportion With Cracks'; run;
The chart is shown in Figure 47.32. The WHERE statement restricts the observations read from BOTTLES so that the control limits are estimated from the January data, and only the January data are displayed on the chart. For details concerning the WHERE statement, refer to SAS Language Reference: Dictionary.
In Figure 47.32, a special cause of variation is signaled by the proportions for January 13 and January 14, which exceed the upper control limit. Since the cause, an improper machine setting, was corrected, it is appropriate to recompute the control limits by excluding the data for these two days. Again, this can be done with a WHERE statement, as follows:
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 outlimits = janlim cframe = vibg cinfill = ywh cconnect = salmon; label ncracks = 'Proportion With Cracks'; run;
The chart is shown in Figure 47.33.
The data set JANLIM, which saves the control limits, is listed in Figure 47.34.

Now, the control limits based on the January data are to be applied to the February data. Again, this can be done with a WHERE statement, as follows:^{*}
title 'Analysis of February Production'; proc shewhart data=bottles limits=janlim; where day > '31JAN94'D; pchart ncracks * day / subgroupn = nbottles nolegend nohlabel cframe = vibg cinfill = ywh cconnect = salmon; label ncracks = 'Proportion With Cracks'; run;
The chart is shown in Figure 47.35.
Chapter Contents 
Previous 
Next 
Top 
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.