02-20-2017 08:55 PM
I need someone to help me with recoding my data.
I have 4 variables (MAT, BIO, PHY, CHE). Each of the variable has students scores from 1 - 9, with 9 being the worst score. For example a student in my dataset has a score of 2 in MAT, 3 in BIO, 4 in PHY and 1 in CHE.
What I want to do is create an aggregate variable from the four subjects using the three best grades. In this example, the three best scores are MAT (2), BIO (3) and CHE (1).
Thus, the new variable, which will be called Aggregate Varaible will AGGREG_VAR = (2+3+1) = 6.
So the score for this student for AGGREG_VAR = 6.
PLEASE I NEED HELP IMPLEMENTING THIS IS SAS.
02-20-2017 09:27 PM
Yes I can have missing values, and there is also the possibility of a student having for example a score of 3 in all subjects, which in this case the maximum will be 3.
Thank you for your help!
02-20-2017 09:30 PM
So a student with two scores would have a lower aggregate than a student with all 4 scores.
@ChrisNZ solution accounts for missing values. If a student who has two missing values is the same as a student who has scores for all 4 then this is fine.
This is a methodological consideration, not an issue with the code.
Need further help from the community? Please ask a new question.