Chapter Contents 
Previous 
Next 
PCHART Statement 
See SHWPEX3 in the SAS/QC Sample Library 
The following statements create a SAS data set named BATTERY, which contains the number of alkaline batteries per lot failing an acceptance test. The number of batteries tested in each lot varies but is approximately 150.
data battery; length lot $3; input lot nfailed sampsize @@;; label nfailed ='Number Failed' lot ='Lot Identifier' sampsize='Number Sampled'; datalines; AE3 6 151 AE4 5 142 AE9 6 145 BR3 9 149 BR7 3 150 BR8 0 156 BR9 4 150 DB1 9 158 DB2 4 152 DB3 0 162 DB5 9 140 DB6 7 161 DS4 6 154 DS6 1 144 DS8 5 154 JG1 3 151 MC3 8 148 MC4 2 143 MK6 4 150 MM1 4 147 MM2 0 150 RT5 2 154 RT9 8 149 SP1 3 160 SP3 9 153 ;
The variable NFAILED contains the number of battery failures, the variable LOT contains the lot number, and the variable SAMPSIZE contains the lot sample size. The following statements request a p chart for this data:
title 'Proportion of Battery Failures'; symbol v=dot c=salmon; proc shewhart data=battery; pchart nfailed*lot / subgroupn = sampsize turnhlabels outlimits = batlim cframe = lib cinfill = bwh cconnect = salmon coutfill = yellow ; label nfailed = 'Proportion Failed'; run;
The chart is shown in Output 38.3.1 and the OUTLIMITS= data set BATLIM is listed in Output 38.3.2.
Output 38.3.1: A p Chart with Varying Subgroup Sample Sizes

The SHEWHART procedure provides various options for working with unequal subgroup sample sizes. For example, you can use the LIMITN= option to specify a fixed (nominal) sample size for computing the control limits, as illustrated by the following statements:
title 'Proportion of Battery Failures'; symbol v=dot c=salmon; proc shewhart data=battery; pchart nfailed*lot / subgroupn = sampsize limitn = 150 alln yscale = percent cframe = lib cinfill = bwh coutfill = yellow cconnect = salmon; label nfailed = 'Percent Failed'; run;
The ALLN option specifies that all points (regardless of subgroup sample size) are to be displayed. By default, only points for subgroups whose sample size matches the LIMITN= value are displayed. The YSCALE= option specifies that the vertical axis is to be scaled in percentages rather than proportions. The chart is shown in Output 38.3.3.
Output 38.3.3: Control Limits Based on Fixed Subgroup Sample Size
Chapter Contents 
Previous 
Next 
Top 
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.