I am trying to select the group with the maximum of a value. An example of how do this in Oracle is below. SQL server also allows this using the first(column) method. SAS SQL does not include either of these two methods. Do I need to write a self join to do this in SAS? I would strongly rather not write a self-join due to it being processor inefficient.
SELECT degree_level, total
select count(*) as total, degree_level
where academic_period= '201410' and college = 'MD'
Your solution is very efficient and I all I need for this solution.
I noticed that the order by block with sub queries seems to cause errors. I was attempting to use an into statement with the order by block. Even if the order by solution worked in this particular case the having is much better.
When I use the into block it automatically selects the top record so if there are two records with the same total I don’t have to worry.
SAS INNOVATE 2024
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.