Hi,
I am trying to import a model built in SAS into SAS EM to compare to models built in SAS EM. I am new to SAS EM, so hopefully there is an easy fix. Here is the situation:
The "model" I am importing is a data set with an ID tag, a binary target, and the prediction for the target. (The model from SAS is a GLM if that matters.) I connect this data set to Model Import. I label appropriate target/prediction variables and run the node. The first time through I always get a run time error, but the next time through it compiles. I do not get any results other than a log. I should be seeing some fit assessment information but that never appears. I am using SAS EM 12.1 if it matters.
If anyone has any ideas how to proceed, or even a source for information about Model Import other than the tutorial/documentation, I would very much appreciate it.
Thanks!
Consider posting this in the SAS Data Mining forum rather than general discussions.
Yes I moved this to Data Mining so that there is a greater chance of getting an answer. thanks!
It is very good idea to start by applying the example attached with the node in EM first.
So did you tried to run the example in SAS Enterprise Miner Help (F1) under the Model Import Node first?
Did it run successfully with you?
Hey Autoleech,
I agree with 100%. Try the example on the reference help as a sanity check just to make sure everything is working.
I also did an example just now on a copy of EM12.1 . Please give it a try and let me know how it went.
1. Attached is the data set Mymodel. It has two predicted values (ptarget and ptarget2) that I got from base SAS proc GLM. Save mymodel data set in some physical location. Mine was "D:\All_Users\miguel".
2. Click on your project properties. Click on the Project Start Code ellipsis to open the editor and then run a libname statement to create a library that contains the data Mymodel. In my example I ran:
libname d "D:\All_Users\miguel";
3. Create a data source for mymodel. The metadata is:
amount - target - interval
ptarget - prediction - interval
ptarget2 - prediction - interval
4. Import the attached XML into Enterprise Miner. (Right click on diagrams, "Import diagram from XML".
5. Run the data source node first.
6. Click on the mapping editor of the first Import Node. Confirm P_Amount maps to ptarget.
7. For the second Import Node, confirm P_Amount is mapped to ptarget2.
8. Run the model comparison and you should see selected the model of the first Model Import.
(click for larger image)
If you get any errors please send a screenshot.
Thanks,
Miguel
FYI
This is the GLM code I used to create the m.mymodel data set:
data germancredit;
set sampsio.dmagecr;
run;
libname d "D:\All_Users\miguel";
ods graphics on;
proc glm;
class purpose marital existcr telephon foreign;
model amount=checking duration history purpose savings employed installp marital coapp age housing existcr depends telephon foreign;
output out=d.mymodel predicted=ptarget;
run;
ods graphics off;
ods graphics on;
proc glm;
class purpose marital telephon foreign;
model amount=duration purpose marital telephon foreign;
output out=d.mymodel predicted=ptarget;
run;
ods graphics off;
proc print data=d.mymodel;
run;
Sorry for the late reply!
Thank you so much for constructing this example. This does work when I run it in SAS EM.
I am happy to give the log with more error information if someone can help with that. I am attaching a picture of the error message.
Did you add the predicted variables in the mapping editor as in the example?
hey autoleech,
yes please! post or send me the log (email is fine). press ctrl+F to find "error: " and hopefully we can understand this better.
I could not reproduce this weird error in which your MI node does not run a first time, then it runs the 2nd time with no error but no results.
It is really weird that you could make my example work OK but it is failing with your data... If this is a data-specific error I hope we can work with tech support on this one.
I'll give it another try in the next 24 hours while I wait for your log and while we wait to hear from tech support.
sorry it's taking more than expected!
-M
SAS support is looking at it now. They were able to reproduce the error. I will update when a solution is known.
By the way, the error is "ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required".
Thanks for all the advice so far.
I found a workaround to the problem (and this might already be fixed for EM 13.2, but I use 12.1 so no luck).
I was importing my data and setting the role to "test" because it was an already scored data set. I wanted to compare this to other models built in EM 12.1. When I set the imported data to "train" I had no problems importing it and using it with model comparison. So you can save your scored data (scored on the test data) from the models built in EM and then import this (setting it to train data) and compare it with the scored data (also set to train data) from outside of EM.
Hopefully that is not too confusing, but the main issue seems to be the role of the imported data set.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.
Find more tutorials on the SAS Users YouTube channel.