You have to first define what "max age count" means.
Is that the number of cases with the maximum age?
Perhaps you want one of these answers?
proc sql;
select age,count
from (select age,count(*) as count from sashelp.class group by age)
having age=max(age)
;
select max_age,sum(age = max_age)
from (select age,max(age) as max_age from sashelp.class)
group by max_age
;
select sex,max_age,sum(age = max_age)
from (select sex,age,max(age) as max_age from sashelp.class)
group by sex,max_age
;
select sex,max_age,sum(age = max_age)
from (select sex,age,max(age) as max_age from sashelp.class group by sex)
group by sex,max_age
;
quit;
Is that the age with the maximum number of cases?
Perhaps you want one of these answers.
proc sql;
select age,count from (select age,count(*) as count from sashelp.class group by age)
having count=max(count)
;
select sex,age,count from (select sex,age,count(*) as count from sashelp.class group by sex,age)
having count=max(count)
;
select sex,age,count from (select sex,age,count(*) as count from sashelp.class group by sex,age)
group by sex
having count=max(count)
;
quit;
... View more