Hi,
I have a table with 45 stores and their total sales. I need to find the stores with the 3 worst sales.
I know I can sort the values ascending and then deduct the last 3 but I wonder if there is a way to find the last 3 directly. when I use de min, its only for one value, how do we do to find the 3 min?
Thank you,
Lyna
How about proc rank?
You could filter the ranked variable to your needs.
Any particular reason why Proc SQL must be used? Almost anything that involves order is more difficult in SQL. Did you mean to say sort ASCENDING and keep the first three results (obs=3)?
Proc Means can do this depending on how many other variables need to be in the output in a single step.
PROC UNIVARIATE does this too:
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.