The HPBIN Procedure

Example 3.4 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;
cards;
       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
run;

  
 proc hpbin data=ex12 numbin=5;
     input x1/numbin=4;
     input x2;
     ods output Mapping=Mapping;
 run;
 
 proc hpbin data=ex12 WOE BINS_META=Mapping;
     target y/level=nominal order=desc;
 run;
 

Output 3.4.1: Number of Observations Table

The HPBIN Procedure

Number of Observations Read 10
Number of Observations Used 9


Output 3.4.2: Weight-of-Evidence Table

Weight of Evidence
Variable Binned Variable Range Non-event
Count
Non-event
Rate
Event
Count
Event
Rate
Weight of
Evidence
Information
Value
x1 BIN_x1   2 1.00000 0 0 0.91629 0.30543
    x1 < 1.500000 1 1.00000 0 0 0.40547 0.06758
    1.500000 <= x1 < 3.000000 0 0 0 0 0 0
    3.000000 <= x1 < 4.500000 1 0.33333 2 0.66667 -1.38629 0.69315
    4.500000 <= x1 2 0.66667 1 0.33333 0 0
x2 BIN_x2   0 0 0 0 0 0
    x2 < 2.200000 2 1.00000 0 0 0.91629 0.30543
    2.200000 <= x2 < 3.400000 0 0 0 0 0 0
    3.400000 <= x2 < 4.600000 2 0.66667 1 0.33333 0 0
    4.600000 <= x2 < 5.800000 0 0 0 0 0 0
    5.800000 <= x2 2 0.50000 2 0.50000 -0.69315 0.23105


Output 3.4.3: Variable Information Value Table

Variable Information
Value
Variable Information Value
x1 1.06615
x2 0.53648