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

Scoring from HPSPLIT model - I get Error: Width specified for format is invalid.

Accepted Solution Solved
Reply
Highlighted
Occasional Contributor
Posts: 6
Accepted Solution

Scoring from HPSPLIT model - I get Error: Width specified for format is invalid.

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.


Accepted Solutions
Solution
‎01-25-2018 06:29 AM
Occasional Contributor
Posts: 6

Re: Scoring from HPSPLIT model - I get Error: Width specified for format is invalid.

Posted in reply to WendyCzika

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.

View solution in original post


All Replies
SAS Super FREQ
Posts: 369

Re: Scoring from HPSPLIT model - I get Error: Width specified for format is invalid.

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.

Occasional Contributor
Posts: 6

Re: Scoring from HPSPLIT model - I get Error: Width specified for format is invalid.

Posted in reply to WendyCzika

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!

SAS Super FREQ
Posts: 369

Re: Scoring from HPSPLIT model - I get Error: Width specified for format is invalid.

It's the data you are scoring that I'm wondering if it has differences:  SCORING.DATA_TO_SCORE

Solution
‎01-25-2018 06:29 AM
Occasional Contributor
Posts: 6

Re: Scoring from HPSPLIT model - I get Error: Width specified for format is invalid.

Posted in reply to WendyCzika

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.

☑ This topic is solved.

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

Discussion stats
  • 4 replies
  • 276 views
  • 2 likes
  • 2 in conversation