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.
Obs | Site_Number | numsites |
1 | 1050 | 1 |
2 | 1200 | 2 |
3 | 1350 | 7 |
4 | 1450 | 6 |
5 | 1451 | 4 |
6 | 1600 | 2 |
7 | 1601 | 7 |
8 | 1602 | 3 |
9 | 5006 | 4 |
10 | 5008 | 1 |
Sort descending and take the first three.
Or ascending and take the last three.
how ddoes output look like
Sites_number | 1601 | 1350 | 1450 |
numsites (max 3) | 7 | 7 | 6 |
Sort descending and take the first three.
Or ascending and take the last three.
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 .
just edit it
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.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.