How do I find a record of maximal value in SAS? I have a dataset of the following structure:
age name
12 joe
15 jane
3 bob
14 rick
I would like to find the value of 'name' for which 'age' is the maximal (in this example - 'jane').
I tried this:
data max;
set ages_data;
if age > max_age then do;
max_age = age;
max_name = name;
end;
retain max_:;
keep max_:;
run;
which is based on what I found here: https://communities.sas.com/message/170554
but it didn't work for me... what am I doing wrong?
Thanks