BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Sean_OConnor
Fluorite | Level 6

Morning,

 

I've run a proc summary which has produced a count of values by different groups.

 

What I would like to do now is take this dataset and output the highest number obs for each group. The issue I'm having is trying to output the top obs per group when there are more than one highest in a group.

 

For instance there could be only 1 for one group but 3 for another. Any ideas how best to overcome this?

 

Thanks,

 

Sean

1 ACCEPTED SOLUTION

Accepted Solutions
sbxkoenk
SAS Super FREQ

4 ways to find the k smallest and largest data values in SAS
By Rick Wicklin on The DO Loop January 26, 2022
https://blogs.sas.com/content/iml/2022/01/26/k-smallest-largest-data.html

 

In CASL code ... you can use the action simple.topK, which selects the top K and bottom K values for variables in a data set, based on a user-specified ranking order.

 

Just don't forget to perform all your analyses by-group based !

 

Koen

View solution in original post

1 REPLY 1
sbxkoenk
SAS Super FREQ

4 ways to find the k smallest and largest data values in SAS
By Rick Wicklin on The DO Loop January 26, 2022
https://blogs.sas.com/content/iml/2022/01/26/k-smallest-largest-data.html

 

In CASL code ... you can use the action simple.topK, which selects the top K and bottom K values for variables in a data set, based on a user-specified ranking order.

 

Just don't forget to perform all your analyses by-group based !

 

Koen

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 253 views
  • 0 likes
  • 2 in conversation