turn on suggestions

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

Showing results for

Find a Community

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

Topic Options

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-26-2015 11:01 AM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-26-2015 11:13 AM

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
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-26-2015 11:52 AM

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
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-26-2015 12:06 PM

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
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-27-2015 11:56 AM

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
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-27-2015 12:00 PM

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
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-27-2015 12:06 PM

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
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-27-2015 12:19 PM

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

---------------------------------------------------------------------------------------------

Maxims of Maximally Efficient SAS Programmers

Maxims of Maximally Efficient SAS Programmers

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-27-2015 12:24 PM

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
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-27-2015 12:29 PM

`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
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-12-2016 08:41 AM

I am finding the same issue as Xiaolin when migrating. The structure of the variables all match, it is only that there are some entries in score= that are not present in data=, but that is supported according to the last point in the documentation provided in the earlier post

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-26-2015 12:03 PM

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.