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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.