I am using PROC RANK with by group processing (pre-sorted). Even though the values are different, PROC RANK returns all 1s for the rank values. Many values are being ranked by the same by group processing. It does not happen with all variables, but it does occur with several of them.
This is the list of example values for a parameter within a single by group (all are rank = 1 in the output dataset):
6.5
0
3.4
0.77777
0.33333
1
2
0
0
0.88888
2
0
0.666666
Show us your code. Click on the running man icon and paste the code into the window that appears (DO NOT SKIP THIS STEP)
proc rank data = CM_BY_FA_S out = CM_BY_FA_ORG_RANKS descending ties = low;
by Manager;
VAR
Var1
Var2
Var3, etc.;
Ranks
Var1_R
Var2_R
Var3_R, etc.;
run;
NOTE: There were 48 observations read from the dataset WORK.CM_BY_FA_S.
NOTE: The data set WORK.CM_BY_FA_ORG_RANKS has 48 observations and 280 variables.
NOTE: PROCEDURE RANK used (Total process time):
real time 0.15 seconds
cpu time 0.07 seconds
There are 140 variables to rank in the dataset.
Show us your code please.
I cannot replicate your issue.
data have;
input X;
cards;
6.5
0
3.4
0.77777
0.33333
1
2
0
0
0.88888
2
0
0.666666
;;;;
proc rank data=have out=want groups=4;
var x;
Ranks x_rank;
run;
proc freq data=want;
table x_rank;
run;
Rank for Variable X | ||||
---|---|---|---|---|
x_rank | Frequency | Percent | Cumulative Frequency |
Cumulative Percent |
0 | 4 | 30.77 | 4 | 30.77 |
1 | 2 | 15.38 | 6 | 46.15 |
2 | 3 | 23.08 | 9 | 69.23 |
3 | 4 | 30.77 | 13 | 100.00 |
@Doug____ wrote:
I am using PROC RANK with by group processing (pre-sorted). Even though the values are different, PROC RANK returns all 1s for the rank values. Many values are being ranked by the same by group processing. It does not happen with all variables, but it does occur with several of them.
This is the list of example values for a parameter within a single by group (all are rank = 1 in the output dataset):
6.5
0
3.4
0.77777
0.33333
1
2
0
0
0.88888
2
0
0.666666
The code you posted uses TIES=LOW. If you are getting all ranks equal to 1, that means that all values for a certain variable are the same. See the following example. The X variable is a constant column, so the ranks are always 1.
data Have;
set Sashelp.Class;
X = 99;
run;
proc rank data = Have out = CM_BY_FA_ORG_RANKS descending ties = low;
VAR Height Weight Age X;
Ranks Height_R Weight_R Age_R X_R;
run;
proc print;
run;
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.