BookmarkSubscribeRSS Feed
ashishj816
Quartz | Level 8

Hi All,

 

I want to show Ranking of Customer Based on Revenue.

I know that there is feature of SAS VA where we can select Rank based on which measure.

But I also want to show Rank number.

 

Ex:-

Customer Name Rank Revenue 
C1 1999
C22998
C33987
C44986
C55985
1 REPLY 1
ballardw
Super User

@ashishj816 wrote:

Hi All,

 

I want to show Ranking of Customer Based on Revenue.

I know that there is feature of SAS VA where we can select Rank based on which measure.

But I also want to show Rank number.

 

Ex:-

Customer Name  Rank  Revenue 
C1  1 999
C2 2 998
C3 3 987
C4 4 986
C5 5 985

Do you want to do this in VA or base programming code? You have posted this in an area that is intended for general programming, not VA.

This is a general programming solution using the Sashelp.class data set and ranking based on height.

proc rank data=sashelp.class
   out=work.classranked
   descending
;
   var height;
   ranks heightrank;
run;

proc sort data=work.classranked;
   by  heightrank;
run;

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 890 views
  • 0 likes
  • 2 in conversation