First a very serious warning where you may have damaged your data in an earlier test or attempt:
Use of code with the output data set the same as the input means the OUTPUT version completely replaces input.
data somename;
set somename;
So a logic error or just running the same code repeatedly that modifies an existing variable can result is multiple changes and unexpected results.
Instead of reusing the same data set create a new one from the input.
ADD code the data step to avoid creating multiple unneeded datasets.
Run this code an share the results. It may show you where you have problems easily:
Proc freq data=mepa.scores;
tables cheese_dy*cheese_wk*cheese_score
butter_dy*butter_wk*butter_score
nuts_dy*nuts_wk*nuts_score
/ list missing;
run;
You do have a problem with the LT or LE for the _dy variables. Missing is always less than anything.
So the following is true when Cheese_dy is missing.
if (cheese_dy le 4)
You would need to make these something like the following to handle missing correctly:
if (0 le cheese_dy le 4)