Only extract max height values based on sex and iam tried below code
proc sql ;
select *, max(height) as height
from clss
group by sex ;
quit;
Data following:
data clss ;
input Name$ Sex$ Age Height Weight ;
cards ;
ghj F 14 50.5 75
HGG F 15 55 80
TYY M 14 52 75
OIU F 15 54 81
POI M 16 65 72
POJ M 15 62 87
KJN F 16 60 81
JHB M 14 61 75
HGV M 11 60 57
NHJ F 12 75 75
JHB M 13 70 55
HGS F 14 65 60
TRT M 13 60 55
QWA F 14 51 65
;
I need output like this
name sex age height weight
NHJ F 12 75 75
JHB M 13 70 55
If you wish to filter on an aggregation use the HAVING key word, like
Having height = max(height)
If you wish to filter on an aggregation use the HAVING key word, like
Having height = max(height)
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.