Reputation: 33
I have a dataset like this:
name age sex region
Paul 60 M 1
Emily 42 F 2
Laura 60 F 2
Brad 48 M 1
Linda 58 F 3
I would like to print the record with maximum value for age, but there are two records with same value (Paul and Laura have same maximum age =60).
How to print an output like this (excluding region variable):
name age sex
Paul 60 M
Laura 60 F
Upvotes: 0
Views: 109
Reputation: 4937
Try this
data have;
input name $ age sex $ region;
datalineS;
Paul 60 M 1
Emily 42 F 2
Laura 60 F 2
Brad 48 M 1
Linda 58 F 3
;
proc sql;
create table want as
select * from have
having max(age) = age;
quit;
Upvotes: 1