OPTBINNING Procedure
Example 27.2 Scoring New Data by Using the ASTORE Procedure
This example illustrates how you can use the OPTBINNING procedure to save a model and then apply the model to score new data by using the ASTORE procedure. 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 SAVESTATE statement saves the model table mylib.scoreModel in the analytic store to the current CAS session:
proc optbinning
data=mylib.datain
param=mylib.parms
adjustfactor=0.2;
savestate rstore=mylib.scoreModel;
run;
Here is a test 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;
Now you can upload the data set test into the CAS session and apply the model mylib.scoreModel by using the ASTORE procedure to generate the score results:
data mylib.test;
set test;
run;
proc astore;
score data=mylib.test out=mylib.score
rstore=mylib.scoreModel copyvar=(name age cash income);
run;
quit;
You can see the scoring results shown in Output 27.2.1 by using the PRINT statement:
proc print data=mylib.score;
run;
Output 27.2.1: Scoring Results from the Score File
| Obs | GRP_AGE | WOE_AGE | GRP_CASH | WOE_CASH | GRP_INCOME | WOE_INCOME | name | age | cash | income |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 1 | -0.30951 | 1 | -0.14409 | 2 | -0.21735 | a | 20 | 500 | 2300 |
| 2 | 2 | 0.22880 | 2 | 0.05232 | 2 | -0.21735 | b | 23 | 1000 | 3000 |
In Output 27.2.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.