The HPBIN Procedure

Example 3.3 Bucket Binning and Weight-of-Evidence Computation

This example shows bucket binning and weight-of-evidence (WOE) computation in two steps. In the first step, PROC HPBIN does bucket binning and generates the mapping table. In the second step, PROC HPBIN takes the mapping table that is generated in the first step as the BINS_META data set and computes the WOE and the information value (IV).

data ex12;
   input cl1 $ x0  x1  x2  y $ freq id;
   datalines;
a     2    .   7  n   2   1
a     2    2   6  .   3   2
a     3    0   1  o   0   3
c     2    3   7  y   .   4
c     2    .   4  n   -5  5
a     3    6   7  n   3   6
b     1    4   4  y   4   7
b     2    5   6  y   3   8
b     1    6   4  o   1   9
b     2    3   2  n   3   10
;

proc hpbin data=ex12 numbin=5;
   ods output Mapping=Mapping;
   input x1/numbin=4;
   input x2;
run;

proc hpbin data=ex12 WOE BINS_META=Mapping;
   target y/level=nominal order=desc;
run;

Figure 8: Number of Observations Table

The HPBIN Procedure

Number of Observations Read10
Number of Observations Used7


Figure 9: Weight-of-Evidence Table

Weight of Evidence
VariableBinned VariableRangeNon-event
Count
Non-event
Rate
Event
Count
Event
Rate
Weight of
Evidence
Information
Value
x1BIN_x1 21000.916290730.30543024
  x1 < 1.511000.405465110.06757752
  1.5 <= x1 < 3000000
  3 <= x1 < 4.510.3333333320.66666667-1.38629440.69314718
  4.5 <= x120.6666666710.3333333300
x2BIN_x2 000000
  x2 < 2.221000.916290730.30543024
  2.2 <= x2 < 3.4000000
  3.4 <= x2 < 4.620.6666666710.3333333300
  4.6 <= x2 < 5.8000000
  5.8 <= x220.5000000020.50000000-0.69314720.23104906


Figure 10: Variable Information Value Table

Variable Information
Value
VariableInformation Value
x11.06615494
x20.53647930


Last updated: March 06, 2023