BookmarkSubscribeRSS Feed
Stuti_
Calcite | Level 5

Hi,

I am using the following code to create decile for my data:
proc rank data = s1 out=s1 groups=10 descending ; var WOE_R10 ; ranks WOE_R10_rnk; run;
But instead of getting 10 ranks, I am only getting 3. Can anyone explain the reasoning for this?

5 REPLIES 5
PaigeMiller
Diamond | Level 26

Most likely, you have ties in your data and so this variable cannot be split into 10 groups, it can only be split into 3 groups.

 

Or possibly, the variable has only 3 non-missing values.

--
Paige Miller
Stuti_
Calcite | Level 5
It does have only 3 value distribution but the ranking is 0 and 5. Shouldn't it be 0,1,2?
PaigeMiller
Diamond | Level 26

@Stuti_ wrote:
It does have only 3 value distribution but the ranking is 0 and 5. Shouldn't it be 0,1,2?

Apparently not.

--
Paige Miller
Stuti_
Calcite | Level 5
Can you explain why?
ballardw
Super User

@Stuti_ wrote:

Hi,

I am using the following code to create decile for my data:
proc rank data = s1 out=s1 groups=10 descending ; var WOE_R10 ; ranks WOE_R10_rnk; run;
But instead of getting 10 ranks, I am only getting 3. Can anyone explain the reasoning for this?


Example data. One suspects massively tied data.

This example only has 3 ranks because there are only 3 values in the data. You get "ranks" other than 0,1,2 based on tie breaking rules.

data example;
  do i=1 to 15;
     do val = 1, 3,5;
     output;
     end;
  end;
run;

proc rank data = example out=ex2 groups=10 descending ;
   var val ; 
   ranks val_rnk; 
run;
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
  • 5 replies
  • 1391 views
  • 1 like
  • 3 in conversation