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:
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.