UCHART Statement: SHEWHART Procedure

Saving Nonconformities per Unit

Note: See u Chart Examples 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 partial listing of Shirts2 is shown in FigureĀ 18.93.

Figure 18.93: The Data Set Shirts2

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



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;
   uchart 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Ā 18.94.

Figure 18.94: The Data Set Shirthist

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



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 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.

For more information, see OUTHISTORY= Data Set.