Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
COMPHISTOGRAM Statement

Example 3.2: Creating a Two-Way Comparative Histogram

See CAPCMH3 in the SAS/QC Sample Library

Two suppliers (A and B) provide disk drives for a computer manufacturer. The manufacturer measures the disk drive opening width to compare the process capabilities of the suppliers and determine whether there has been an improvement from 1992 to 1993.

The following statements save the measurements in a data set named DISK. There are two classification variables, SUPPLIER and YEAR, and a format is associated with YEAR.

   proc format ;
      value mytime  1 = '1992'
                    2 = '1993' ;

   data disk;
      input @1 supplier $10. year width;
      label width = 'Opening Width (inches)';
      format year mytime.;
      datalines;
   Supplier A   1   1.8932
   Supplier A   1   1.8952
       .        .    .
       .        .    .
   Supplier B   1   1.8980
   Supplier B   1   1.8986
   Supplier A   2   1.8978
   Supplier A   2   1.8966
       .        .    .
       .        .    .
   Supplier B   2   1.8967
   Supplier B   2   1.8997
   ;

The following statements create the comparative histogram in Output 3.2.1:

   title "Results of Supplier Training Program";
   proc capability data=disk noprint;
      specs  lsl = 1.8925  clsl = black  llsl = 2
             usl = 1.9027  cusl = black  lusl = 3 ;
      comphist width / class      = ( supplier year )
                       classkey   = ('Supplier A' '1993')
                       intertile  = 1.0
                       vaxis      = 0 10 20 30
                       ncols      = 2
                       nrows      = 2
                       cfill      = orange
                       cframetop  = ligr
                       cframeside = ligr
                       cframe     = ligr;
      inset cpk (4.2) / noframe pos = n;
   run;

Output 3.2.1: Two-Way Comparative Histogram
capchex2.gif (8956 bytes)

The CLASSKEY= option specifies the key cell as the observations for which SUPPLIER is equal to SUPPLIER A and YEAR is equal to 2. This cell determines the binning for the other cells, and (since the NOKEYMOVE option is not specified) the columns are interchanged so that this cell is displayed in the upper left corner. Note that if the CLASSKEY= option were not specified, the default key cell would be the observations for which SUPPLIER is equal to SUPPLIER A and YEAR is equal to 1. If the CLASSKEY= option were not specified (or if the NOKEYMOVE option were specified), the column labeled 1992 would be displayed to the left of the column labeled 1993. See the entry for the CLASSKEY= option.

The VAXIS= option specifies the tick mark labels for the vertical axis, while NROWS=2 and NCOLS=2 specify a 2 ×2 arrangement for the tiles. The CFRAMESIDE= and CFRAMETOP= options specify fill colors for the row and column labels, and the CFILL= option specifies a fill color for the bars. The INSET statement is used to display the capability index Cpk for each cell. Output 3.2.1 provides evidence that both suppliers have reduced variability from 1992 to 1993.

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.