BookmarkSubscribeRSS Feed
Xiaolin
Fluorite | Level 6

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
ballardw
Super User

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.

Xiaolin
Fluorite | Level 6

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?

ballardw
Super User

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.

Xiaolin
Fluorite | Level 6

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!

Reeza
Super User

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?

Xiaolin
Fluorite | Level 6

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.

Xiaolin
Fluorite | Level 6

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?

Reeza
Super User
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-adamson
Fluorite | Level 6

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

data_null__
Jade | Level 19

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 11 replies
  • 1909 views
  • 1 like
  • 6 in conversation