Chapter Contents Previous Next
 UCHART Statement

## Saving Nonconformities per Unit

 See SHWUCHR in the SAS/QC Sample Library

In this example, the UCHART statement is used to create a summary data set containing the number of nonconformities per unit. This data set can be read later by the SHEWHART procedure (as in the preceding example).

A 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 listing of SHIRTS2 is shown in Figure 41.8.

 Number of Shirt Flaws per Box

 box avgdefu avgdefn 1 0.4 10 2 0.7 10 3 0.5 10 4 1.0 10 5 0.3 10 6 0.2 10 7 0.0 10 8 0.4 10 9 0.4 10 10 0.6 10 11 0.2 10 12 0.7 10 13 0.3 10 14 0.1 10 15 0.3 10 16 0.6 10 17 0.6 10 18 0.3 10 19 0.7 10 20 0.3 10 21 0.0 10 22 0.1 10 23 0.5 10 24 0.6 10 25 0.4 10
Figure 41.8: The Data Set SHIRTS2

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:

```   title 'Average Defects Per Tee Shirt';
proc shewhart data=shirts2;
uchart flaws*box / subgroupn =nshirts
outhistory=shrthist
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 listing of SHRTHIST is shown in Figure 41.9.

 Average Defects Per Tee Shirt

 box flawsU flawsN 1 0.30 10 2 0.80 10 3 0.60 25 4 0.80 25 5 0.36 25 6 0.10 10 7 0.10 10 8 0.42 50 9 0.30 10 10 0.70 10 11 0.10 10 12 0.84 25 13 0.36 25 14 0.12 25 15 0.24 50 16 0.36 50 17 0.70 10 18 0.40 10 19 0.80 10 20 0.40 10
Figure 41.9: The Data Set SHRTHIST

There are three variables in the data set SHRTHIST.

• 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 FLAWS specified in the UCHART statement. In other words, the variable naming convention for OUTHISTORY= data sets is the same as that for HISTORY= data sets.