I have the following dataset:
school id score state year university_a 1 150 Cal 2000 university_a 2 152 Cal 2000 university_b 3 151 Ny 2000
Each school enrolls individuals in each state and year. I am interested to find out the number of schools that each individual can enroll in based on his score and the cutoff score of all schools participated in the enrollment process in his province and year.

I can solve the problem by collapsing the dataset to get the cutoffs for each school-state-year combination, and merging back to the original dataset. But the problem is that these would create over 1000 variables and the dataset becomes too large.

Is there a solution that does not involve creating a variable for each cutoff?