Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Programming
- /
- SAS Procedures
- /
- PROC SCORE error in SAS 9.4 but not in 9.1.3

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 01-26-2015 11:01 AM
(1688 views)

Hi,

We are trying to migrate to SAS 9.4 and I am testing my code under 9.4. The same code works fine in our current 9.1.3, but generate the errors in 9.4.

The source code:

proc score data=INPUT

score=PARAMETERS out=test PREDICT TYPE=PARMS;

by A B C D;

id E F G H;

run;

The error message:

ERROR: BY values from PARAMETERS and INPUT do not match.

NOTE: The above message was for the following BY group:

A =_A B=1 C=2 D=0

ERROR: BY values from PARAMETERS and INPUT do not match.

NOTE: The above message was for the following BY group:

A =_A B=1 C=2 D=1

.... (hundreds similar errors)

Does anyone have experience with this? The SAS online document does not mention any change of the PROC SCORE in 9.4, and does not mention any related system options change. I am really puzzled. Could anyone help? Thank you very much in advance!

Xiaolin

11 REPLIES 11

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Is the INPUT data set the same one you ran the 9.1 code with. Exactly the same?

A likely place to look would be an import step with a variable changing type.

Run proc contents on you input and parameters datasets and look for type mismatches.

Or you have combinations of values in INPUT that do not match Parameters one way or the other.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thank you for the reply!

The dataset I used in 9.1 are exactly the same as the one used in 9.4.

I did find some variables had different length, somehow it didn't cause any trouble in 9.1. I tried to changed all the variables length and format in INPUT to be the same as those in PARAMETERS, but still getting the same error

Any more ideas?

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

After a somewhat snarky comment that different lengths means the sets are not EXACTLY the same.. Are any of the different lengths character in one set and numeric in the other?

I would be tempted to do something like to find the differences:

proc sql;

Title "Values in INPUT not in PARAMETERS";

select * from (select distinct a,b,c,d from input)

except

select * from (select distinct a,b,c,d from Parameters);

Title "Values in PARAMETERS not in INPUT";

select * from (select distinct a,b,c,d from Parameters )

except

select * from (select distinct a,b,c,d from input Parameters);

quit;

I'd bet that you input data has somehow included some new combinations of values that you weren't told to expect.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thank you very much ballardw and data_null for your reply.

I have done a few test to try to figure out what the problem is, now I seem to have a clue but not a solution.

In my both of my DATA = INPUT and SCORE=PARAMETERS dataset, there are BY group - A, B, C, D, and some other variables not in the BY groups. This BY group can have many combination based on the possible values of these four variables.

In the log I can see that the error only complains about the BY group combination that exist in SCORE but not in DATA. If I expand the DATA dataset with some fake numbers just to make it have exactly the same BY group combination as in SCORE, it works fine. So it doesn't seem to do with the length of variables.

I thought as long as all the BY group combination in DATA also appear in SCORE dataset, this should be fine, at least it is the case in my old SAS. And the SAS document also doesn't mention the two has to be the same.

Any idea why it is like this? Thank you so much!

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Do you have any of the BY values in the Score that are not in the Data at all?

ie A = 1, 2, 3, 4 in Data

but A= 1, 2, 3, 4, 5 in Score?

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Yes, I have. Like your example, not all the BY values in SCORE appear in DATA.

Should this be a problem? I thought in this situation only the coefficients matched in SCORE would be used in calculation.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

According to the SAS documentation cited by data_null_, this WILL be a problem.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

In the last sentence of the document it says:

If you do not specify the NOTSORTED option, some BY groups can appear in the SCORE= data set but not in the DATA= data set; such BY groups are not used in computing scores.

I didn't specify this option and therefore I think this should not be a problem?

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

`If the DATA= data set contains some but not all of the BY variables, or if some BY variables do not have the same type or length in the DATA= data set as in the SCORE= data set, then PROC SCORE prints an error message and stops.`

I think you should contact Tech Support if you care to proceed with looking into this. As far as I can see SAS is behaving the way I'd expect according to the documentation in 9.4, perhaps it didn't in 9.1 but I can't test that.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Perhaps the change to PROC SCORE was in version 9.2 or 9.3. Going from 9.1.3 to 9.4 is a big leap.

Does your BY variable data meet the criteria describe here below from 9.4 documentation.

You can specify a BY statement to apply separate groups of scoring coefficients to the entire DATA= data set.

If the DATA= data set does not contain any of the BY variables, the entire DATA= data set is scored by each BY group of scoring coefficients in the SCORE= data set.

If the DATA= data set contains some but not all of the BY variables, or if some BY variables do not have the same type or length in the DATA= data set as in the SCORE= data set, then PROC SCORE prints an error message and stops.

If all the BY variables appear in the DATA= data set with the same type and length as in the SCORE= data set, then each BY group in the DATA= data set is scored using scoring coefficients from the corresponding BY group in the SCORE= data set. The BY groups in the DATA= data set must be in the same order as in the SCORE= data set. All BY groups in the DATA= data set must also appear in the SCORE= data set. If you do not specify the NOTSORTED option, some BY groups can appear in the SCORE= data set but not in the DATA= data set; such BY groups are not used in computing scores.

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

**If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. **

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.