OPTBINNING Procedure
Example 27.1 Scoring New Data by Using a Score Model
This example illustrates how you can use the OPTBINNING procedure to save a model table and then use the model table later to score a data table. Assume that you already have the input data table mylib.datain and the input parameter table mylib.parms loaded into your CAS session, as in the section Getting Started: OPTBINNING Procedure.
The following statements run PROC OPTBINNING to generate a scoring model, and the CODE statement outputs the score file score.txt to the current local directory:
proc optbinning
data=mylib.datain
param=mylib.parms
adjustfactor=0.2;
code file="score.txt";
run;
The following DATA step creates a data set in which each observation contains the customer’s age, cash reserves, and income:
data test;
input name $ age cash income;
datalines;
a 20 500 2300
b 23 1000 3000
;
run;
You can include the score file in the following DATA statement, or you can paste the contents of the file inside the DATA statement to do the scoring, as follows:
data out;
set test;
%inc "score.txt";
run;
You can see the scoring results shown in Output 27.1.1 by using the PRINT statement:
proc print data=out; run;
Output 27.1.1: Scoring Results from the Score File
| Obs | name | age | cash | income | GRP_AGE | WOE_AGE | GRP_CASH | WOE_CASH | GRP_INCOME | WOE_INCOME |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | a | 20 | 500 | 2300 | 1 | -0.30951 | 1 | -0.14409 | 2 | -0.21735 |
| 2 | b | 23 | 1000 | 3000 | 2 | 0.22880 | 2 | 0.05232 | 2 | -0.21735 |
In Output 27.1.1, the generated columns GRP_AGE, GRP_CASH, and GRP_INCOME contain the bin numbers for the matching characteristic for each customer. For example, the GRP_AGE column has the bin numbers for the age characteristic. The generated columns WOE_AGE, WOE_CASH, and WOE_INCOME contain the weight of evidence (WOE) values for the matching characteristic for each customer. For example, the WOE_AGE column has the WOE values for the age characteristic.