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)
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.