BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mona4u
Lapis Lazuli | Level 10

 

I have this dataset and I want to create a report that include the max 3 of numsites. I tried proc univariate but the problem is it gonna include the highest and the lowest in the output and I couldn't find option that exclude the lowest . 

Please advise me what is the best way to get the result.  

 

 

ObsSite_Numbernumsites
110501
212002
313507
414506
514514
616002
716017
816023
950064
1050081
1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Sort descending and take the first three.

Or ascending and take the last three. 

 

 

View solution in original post

6 REPLIES 6
kiranv_
Rhodochrosite | Level 12

how ddoes output look like

mona4u
Lapis Lazuli | Level 10
 Sites_number160113501450
numsites (max 3) 776
Reeza
Super User

Sort descending and take the first three.

Or ascending and take the last three. 

 

 

Reeza
Super User

Is that what you have? What would be the expected output for that data?

 

Your requirements are not clear, no idea what the following means

 

I tried proc univalent but the problem is it gonna include the highest and the lowest in the output and I couldn't find option that exclude the lowest . 

mona4u
Lapis Lazuli | Level 10

just edit it 

jimhorne
Obsidian | Level 7

You could investigate PROC RANK and merging its results back with your original data if you want to do a little programming so the computer can reproduce it at will.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 2138 views
  • 2 likes
  • 4 in conversation