Hi,
I created a model using the HPSPLIT proc. The model was successfully saved into the file 'HPSPLIT_model.sas'.
However, I can't use it to score new data! I'm getting format errors, which are quite cryptic to me as a new SAS user. I added 1 example of such error below, but I'm getting many of them.
Any idea what the issue is, and what the solution could be?
Thanks!
data SCORES.SCORED_DATA;
set SCORING.DATA_TO_SCOREend=eof;
%include "HPSPLIT_model.sas";
Prediction=P_target1;
run;
14950 +_RT_68_16 = ' ';
14951 +DROP _RT_68_16;
14952 +_RT_68_16 = PUT(HUG_STS, $16.);
14953 +%DMNORMIP(_RT_68_16);
14954 +LENGTH _RT_75_50 $50;
WARNING: Variable MODEL_SPEC has already been defined as numeric.
14955 +_RT_75_50 = ' ';
14956 +DROP _RT_75_50;
14957 +_RT_75_50 = PUT(MODEL_SPEC, $50.);
----
29
ERROR 29-185: Width specified for format is invalid.
Sorry Wendy,
I'm modifying the table/variable names to ensure confidentiality...and I wasn't consistent in my 'modified' names.
I should have written:
data SCORING.DATA_TO_SCORE;
set SOURCE.MyData (WHERE=(data_role='Test'));
run;
data Training.data_train;
set SOURCE.MyData (WHERE=(data_role='Train'));
run;
Anyway, I removed all the code in the .sas Decision Tree model files that appeared between these 2 comments:
****** TEMPORARY VARIABLES FOR FORMATTED VALUES ******;
****** ASSIGN OBSERVATION TO NODE ******;
So far it seems to work. However, My model is actually built from 200+ 'sub-models', so I have 200+ files to edit. I guess it can be done with a UNIX command.
My guess is that MODEL_SPEC was a character variable in your training data that was used to create the model and score code, and it is numeric in the data you are scoring. It would need to be the same type in both data sets.
Hi Wendy,
Thanks a lot for your answer.
However, both the training/testing datasets are created from the exact same code (except for what I'm filtering on.)
data SCORING.data_test;
set SOURCE.MyData (WHERE=(data_role='Test'));
run;
data Training.data_train;
set SOURCE.MyData (WHERE=(data_role='Train'));
run;
I'll try to see if anything else could cause the difference in the data types.
Thanks!
It's the data you are scoring that I'm wondering if it has differences: SCORING.DATA_TO_SCORE
Sorry Wendy,
I'm modifying the table/variable names to ensure confidentiality...and I wasn't consistent in my 'modified' names.
I should have written:
data SCORING.DATA_TO_SCORE;
set SOURCE.MyData (WHERE=(data_role='Test'));
run;
data Training.data_train;
set SOURCE.MyData (WHERE=(data_role='Train'));
run;
Anyway, I removed all the code in the .sas Decision Tree model files that appeared between these 2 comments:
****** TEMPORARY VARIABLES FOR FORMATTED VALUES ******;
****** ASSIGN OBSERVATION TO NODE ******;
So far it seems to work. However, My model is actually built from 200+ 'sub-models', so I have 200+ files to edit. I guess it can be done with a UNIX command.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.