COMPHISTOGRAM Statement: CAPABILITY Procedure

Syntax: COMPHISTOGRAM Statement

The syntax for the COMPHISTOGRAM statement is as follows:

  • COMPHISTOGRAM <variables> / CLASS=(class-variables) <options >;

You can specify the keyword COMPHIST as an alias for COMPHISTOGRAM. You can use any number of COMPHISTOGRAM statements after a PROC CAPABILITY statement.

To create a comparative histogram, you must specify at least one variable and either one or two class-variables (also referred to as classification variables). The COMPHISTOGRAM statement displays a component histogram of the values of the variable for each level of the class-variables. The observations in a given level are referred to as a cell.

The components of the COMPHISTOGRAM statement are described as follows:

variables

are the process variables for which comparative histograms are to be created. If you specify a VAR statement, the variables must also be listed in the VAR statement. Otherwise, variables can be any numeric variables in the input data set that are not also listed as class-variables. If you do not specify variables in a COMPHISTOGRAM statement or a VAR statement, then by default a comparative histogram is created for each numeric variable in the DATA= data set that is not used as a class-variable. If you use a VAR statement and do not specify variables in the COMPHISTOGRAM statement, then by default a comparative histogram is created for each variable listed in the VAR statement.

For example, suppose a data set named steel contains two process variables named length and width, a numeric classification variable named lot, and a character classification variable named day. The following statements create two comparative histograms, one for length and one for Width:

proc capability data=steel;
   comphist / class = lot;
run;

Likewise, the following statements create comparative histograms for length and width:

proc capability data=steel;
   var length width;
   comphist / class = day;
run;

The following statements create three comparative histograms (for length, width, and lot):

proc capability data=steel;
   comphist / class = day;
run;

The following statements create a comparative histogram for Width only:

proc capability data=steel;
   var length width;
   comphist width / class=lot;
run;
class-variables

are one or two required classification variables. For example, the following statements create a one-way comparative histogram for width by using the classification variable lot:

proc capability data=steel;
   comphist width / class=lot;
run;

The following statements create a two-way comparative histogram for width classified by lot and day:

proc capability data=steel;
   comphist width / class=(lot day);
run;

Note that the parentheses surrounding the class-variables are needed only if two classification variables are specified. See Output 5.6.1 and Output 5.7.1 for further examples.

options

control the features of the comparative histogram. All options are specified after the slash (/) in the COMPHIST statement. In the following example, the CLASS= option specifies the classification variable, the NORMAL option fits a normal density curve in each cell, and the CTEXT= option specifies the color of the text:

proc capability data=steel;
   comphist length / class = lot
                     normal
                     ctext = yellow;
run;