🔒 This topic is solved and locked.
Need further help from the community? Please
sign in and ask a new question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 08-01-2017 07:54 AM
(45524 views)
I need to sum the hits of each player and then show the max one. This is my code, but I has syntax problem on this nested sql, can someone help to figure out?
proc sql;
title2"Part 2d";
select distinct PlayerID, min(YearID) label="First Year", sum(H) as Total_Hits
group by PlayerID
where Total_Hits=max(Total_Hits);
quit;
title;
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
proc sql;
select *
from (
select sex,sum(height) as total
from sashelp.class
group by sex
)
having total=max( total);
quit;
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
What nested SQL?
I can see off the bat that where should be having.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
proc sql;
select *
from (
select sex,sum(height) as total
from sashelp.class
group by sex
)
having total=max( total);
quit;