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.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.