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?
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.
@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.
@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;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.