BINNING Procedure

Example 5.3 Bucket Binning and Weight-of-Evidence Computation

(View the complete code for this example.)

The following DATA step generates a data table that contains 10 observations of a target variable (y), three continuous variables (x0–x2), and some other variables. The mylib CAS library reference enables your client machine to communicate with the CAS session.

data mylib.ex3;
   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
;

The following statements show how you can use the BINNING procedure to perform bucket binning and compute the WOE and the information value (IV):

proc binning data=mylib.ex3 numbin=5 woe;
   input x1/numbin=4;
   input x2;
   target y/event="y";
   output out=mylib.out3;
run;

The DATA= option specifies the input data table. The WOE option enables computation of the weight of evidence and information values with WOEADJUST=0.5 by default. The first INPUT statement names one continuous variable (x1) as the first input variable for binning with four bins. The second INPUT statement names another continuous variable (x2) as the second input variable for binning with five bins, as specified in the NUMBIN= global option. The TARGET statement names the variable (y) that PROC BINNING uses to calculate the weight of evidence, and the EVENT= option specifies the target event category in a quoted string. The OUTPUT statement creates an OUTPUT data table to contain the results of PROC BINNING.

The preceding statements generate Output 5.3.1 through Output 5.3.2.

Output 5.3.1: Bin Details

The BINNING Procedure

Bin Details
VariableBin IDLower
Bound
Upper
Bound
Bin
Width
Number of
Observations
MeanStandard
Deviation
MinimumMaximumEvent
Count
Weight of
Evidence
Information
Value
x1Missing   2    00.91630.3054
 1-Infty1.5000 10 0000.40550.0676
 21.500031.500012 220..
 334.50001.500033.33330.5774342-1.3860.6931
 44.5000Infty 35.66670.577456100
x2Missing   0    0..
 1-Infty2.2000 21.50000.70711200.91630.3054
 22.20003.40001.20000    0..
 33.40004.60001.200034044100
 44.60005.80001.20000    0..
 55.8000Infty 56.60000.5477672-0.6930.2310


Output 5.3.2: Variable Information Value

Variable Information
Value
VariableInformation
Value
x11.0662
x20.5365


Last updated: September 22, 2026