Given a script below, for each team, the top earner for players that have at least 30 assists;
proc sql;
create table basketball_summary as
select team, salary, first(case when nAssts >= 30 then Name end) as Name
from sashelp.baseball
group by team
order by team, salary;
quit;
the main issue issue here is that the first() function returns the first character in a string instead of the first row.
Any solution other than proc sql would also be welcome
If I understand it well, you should write your query like this:
This way you group by team, and select the one that has the best salary, provided by
max(salary), and has at least 30 assists. Please, give me a feedback that the query works as you expect.