Help using Base SAS procedures

PROC SCORE error in SAS 9.4 but not in 9.1.3

Reply
Occasional Contributor
Posts: 5

PROC SCORE error in SAS 9.4 but not in 9.1.3

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

Grand Advisor
Posts: 10,069

Re: PROC SCORE error in SAS 9.4 but not in 9.1.3

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.

Occasional Contributor
Posts: 5

Re: PROC SCORE error in SAS 9.4 but not in 9.1.3

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 Smiley Sad

Any more ideas?

Grand Advisor
Posts: 10,069

Re: PROC SCORE error in SAS 9.4 but not in 9.1.3

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.

Occasional Contributor
Posts: 5

Re: PROC SCORE error in SAS 9.4 but not in 9.1.3

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!

Grand Advisor
Posts: 16,928

Re: PROC SCORE error in SAS 9.4 but not in 9.1.3

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?

Occasional Contributor
Posts: 5

Re: PROC SCORE error in SAS 9.4 but not in 9.1.3

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.

Esteemed Advisor
Posts: 6,334

Re: PROC SCORE error in SAS 9.4 but not in 9.1.3

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

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 5

Re: PROC SCORE error in SAS 9.4 but not in 9.1.3

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?

Grand Advisor
Posts: 16,928

Re: PROC SCORE error in SAS 9.4 but not in 9.1.3

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.

New Contributor
Posts: 4

Re: PROC SCORE error in SAS 9.4 but not in 9.1.3

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

Respected Advisor
Posts: 3,773

Re: PROC SCORE error in SAS 9.4 but not in 9.1.3

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.

Ask a Question
Discussion stats
  • 11 replies
  • 538 views
  • 1 like
  • 6 in conversation