See SHWCCHR1 in the SAS/QC Sample LibraryA department store receives boxes of shirts containing 10, 25, or 50 shirts. Each box is inspected, and the total number of
defects per box is recorded. The following statements create a SAS data set named Shirts2
, which contains the total defects per box for 20 boxes:
data Shirts2; input Box Flaws Nshirts @@; datalines; 1 3 10 2 8 10 3 15 25 4 20 25 5 9 25 6 1 10 7 1 10 8 21 50 9 3 10 10 7 10 11 1 10 12 21 25 13 9 25 14 3 25 15 12 50 16 18 50 17 7 10 18 4 10 19 8 10 20 4 10 ;
A partial listing of Shirts2
is shown in Figure 17.22.
Figure 17.22: The Data Set Shirts2
Number of Shirt Flaws per Box |
Box | Flaws | Nshirts |
---|---|---|
1 | 3 | 10 |
2 | 8 | 10 |
3 | 15 | 25 |
4 | 20 | 25 |
5 | 9 | 25 |
The variable Box
contains the box number, the variable Flaws
contains the number of flaws in each box, and the variable Nshirts
contains the number of shirts in each box. To evaluate the quality of the shirts, you should report the average number of
defects per shirt. The following statements create a data set containing the number of flaws per shirt and the number of shirts
per box:
proc shewhart data=Shirts2; cchart Flaws*Box / subgroupn = Nshirts outhistory = shirthist nochart ; run;
The SUBGROUPN= option names the variable in the DATA= data set whose values specify the number of inspection units per subgroup.
The OUTHISTORY= option names an output data set containing the number of nonconformities per inspection unit and the number
of inspection units per subgroup. A partial listing of Shirthist
is shown in Figure 17.23.
Figure 17.23: The Data Set Shirthist
Average Defects Per Shirt |
Box | FlawsU | FlawsN |
---|---|---|
1 | 0.30 | 10 |
2 | 0.80 | 10 |
3 | 0.60 | 25 |
4 | 0.80 | 25 |
5 | 0.36 | 25 |
There are three variables in the data set Shirthist
.
Box
contains the subgroup index.
FlawsU
contains the numbers of nonconformities per inspection unit.
FlawsN
contains the subgroup sample sizes.
Note that the variables containing the numbers of nonconformities per inspection unit and subgroup sample sizes are named
by adding the suffix characters U and N to the process Defects
specified in the CCHART statement. In other words, the variable naming convention for OUTHISTORY= data sets is the same as
that for HISTORY= data sets.
For more information, see OUTHISTORY= Data Set.