Building models with SAS Enterprise Miner, SAS Factory Miner, SAS Visual Data Mining and Machine Learning or just with programming

How to score an external dataset using SAS Eminer 12.1?

Accepted Solution Solved
Reply
Super Contributor
Posts: 269
Accepted Solution

How to score an external dataset using SAS Eminer 12.1?

Hi,

Can anyone point out how to score a model using an external dataset in SAS Eminer 12.1?

Thanks,

saspert.


Accepted Solutions
Solution
‎07-10-2017 04:11 PM
SAS Employee
Posts: 68

Re: How to score an external dataset using SAS Eminer 12.1?

[ Edited ]

To score your dataset in SAS Enterprise Miner, you add a score node at the end of your modeling flow.  You then add the data set you wish to score as in an input dataset with an arrow connected into the Score node. Change the role of the newly added dataset to Score in the Train properties.

 

To save the output dataset, add a Save Data node after the Score node.

Alternatively, you can use a SAS Code node in which case you would write a data step like the following to save a data set called NEWSCORES in the path defined by the libname statement for YOURLIB.

 

libname YOURLIB ' < path to library relative to where SAS EM is installed > ';

data YOURLIB.NEWSCORES;

set &EM_IMPORT_SCORE

RUN;

 

You can also export the score code by using the Score Export node after the Score node.  You can take these files and use the Scoring Accelerator to automatically publish this score code to a database, and then execute scoring inside the database.

View solution in original post


All Replies
Valued Guide
Posts: 3,208

Re: How to score an external dataset using SAS Eminer 12.1?

Getting Started with SAS(R) Enterprise Miner(TM) 12.3 (Score New Data)

Several options.
- score wiht your project (libname)

- generate the code SAS (JAVA and C possible needing compliation) and let it have that run

---->-- ja karman --<-----
Super Contributor
Posts: 269

Re: How to score an external dataset using SAS Eminer 12.1?

Hi Jaap,

Do you know if it is the same procedure whether the dataset is training or external?

Thanks,
Raj.

Super User
Posts: 17,960

Re: How to score an external dataset using SAS Eminer 12.1?

What do you mean by "external data"?

SAS EMiner will provide the code to score the dataset. Take that code and export it to base SAS or put it in a program node and use it.

Super Contributor
Posts: 269

Re: How to score an external dataset using SAS Eminer 12.1?

Hi Reeza,

I wish I was a bit more articulate when it comes to Eminer. So the user has built a model using a sample dataset that he split 80:20 for training and validation. Now he wants to use this model on real world data to be able to score for each observation in the dataset. So, I just discussed with the user and he says he tried the score option like the SAS user documention page (also suggested above by Jaap) but it gives him source code in C /Java and summary statistics but no "scored dataset" per say. So, we were wondering how to get the scored dataset.

Super User
Posts: 17,960

Re: How to score an external dataset using SAS Eminer 12.1?

The user should be able to export SAS code to score the dataset, not just in C/Java.  Then use that code to score the dataset in Base SAS or EG or whatever production environment you have.

EDIT:

From the docs:

Note: The SAS scoring code is viewable in the node results.

Super Contributor
Posts: 269

Re: How to score an external dataset using SAS Eminer 12.1?

Thanks. I guess I have to point out the user. So I picked up this code from the scoring node in Eminer and I am thinking this where the data references have to be changed.

%macro em_usedatatable;

%if ^%symexist(EM_USEDATATABLE) %then %do;

%let EM_USEDATATABLE = Y;

%end;

%if "&EM_USEDATATABLE" ne "N" %then %do;

%global Ids7_data Ids7_newdata;

%global Ids_data Ids_newdata;

*------------------------------------------------------------*;

* Data Tables;

*------------------------------------------------------------*;

%let Ids7_data = MES.Z17_FINAL_DATA;

%let Ids7_newdata =;

%let Ids_data = MES.Z17CENTER_PBG11A;

%let Ids_newdata = MES.Z17CENTER_PBG11A;

*------------------------------------------------------------*;

%end;

%global Ids7_source;

%if "&Ids7_newdata" ne "" %then %do;

%let Ids7_source = USERTABLE;

%end;

%else %do;

%let Ids7_source = DATASOURCE;

%end;

%global Ids_source;

%if "&Ids_newdata" ne "" %then %do;

%let Ids_source = USERTABLE;

%end;

%else %do;

%let Ids_source = DATASOURCE;

%end;

%mend em_usedatatable;

%em_usedatatable;

Super User
Posts: 17,960

Re: How to score an external dataset using SAS Eminer 12.1?

That doesn't look like score code to me, but I don't understand your model at all.

The code from EM has to be put in a data step, you add in the data and set statements and the run.

It does assume the variable names are the same.

Valued Guide
Posts: 3,208

Re: How to score an external dataset using SAS Eminer 12.1?

I just finished the miner ecourse, Miner is working in the semma approach.
The extraction stage and bootstrap options are steps outside miner.

Building models starts with splitting your input dataset in a train and validate (optional test) parts.

In this dataset input varibles and output (target) are known. Missing values to solve (imputation)
While building the model the training part is to get the models right. The test part to check on overtraining so getting the expectations on the real world (scoring).   With all steps miner takes a lot of the work on that between train and test.

Having your model, just some calculations on some input variables, you can go to the scoring step.

The same input variables must be present just the target is unknown (that was the goal of the model),

Perhaps you have access to that dataset, you can score within Miner

Perhaps someone wants the SAS-code (export that) to run that for you.

Perhaps it must be included in a JAVA or C execution.

Where the production data resides we can not know. It was started with modeling, so at that point it should be known by someone..          

---->-- ja karman --<-----
Solution
‎07-10-2017 04:11 PM
SAS Employee
Posts: 68

Re: How to score an external dataset using SAS Eminer 12.1?

[ Edited ]

To score your dataset in SAS Enterprise Miner, you add a score node at the end of your modeling flow.  You then add the data set you wish to score as in an input dataset with an arrow connected into the Score node. Change the role of the newly added dataset to Score in the Train properties.

 

To save the output dataset, add a Save Data node after the Score node.

Alternatively, you can use a SAS Code node in which case you would write a data step like the following to save a data set called NEWSCORES in the path defined by the libname statement for YOURLIB.

 

libname YOURLIB ' < path to library relative to where SAS EM is installed > ';

data YOURLIB.NEWSCORES;

set &EM_IMPORT_SCORE

RUN;

 

You can also export the score code by using the Score Export node after the Score node.  You can take these files and use the Scoring Accelerator to automatically publish this score code to a database, and then execute scoring inside the database.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 9 replies
  • 1729 views
  • 0 likes
  • 4 in conversation