- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Good day dear All,
I am new here. Taking SAS courses and have a question regarding the Rank procedure. The thing is, when I'm using it my ranking values are not integres.
I want to rank the goals quantities in order to find the second highest values of each category.
proc rank data=LaLiga out=rankings;
var goals;
ranks result;
proc print data=rankings;
run;
why it doesn't work here?
thanks in advance.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I want to rank the goals quantities in order to find the second highest values of each category.
If "category" means Position, then you want to make position a BY variable.
proc sort data=have;
by position;
run;
proc rank data=have out=rankings descending ties=low;
by position;
var goals;
ranks goals_ranked;
run;
As stated, you will have to figure out which option of TIES= works best for you.
If you don't care about ties, then just sort the data by position and goals, and take the 2nd record for each position.
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Try out different values of the TIES= option on the PROC RANK statement, and see which one gets what you want:
https://go.documentation.sas.com/doc/en/pgmsascdc/v_060/proc/p16s2o8e4bnqrin1phywxdaxqba7.htm#n128ut...
Since it looks like this is data where a higher number of goals is better, also consider using the DESCENDING option.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I want to rank the goals quantities in order to find the second highest values of each category.
If "category" means Position, then you want to make position a BY variable.
proc sort data=have;
by position;
run;
proc rank data=have out=rankings descending ties=low;
by position;
var goals;
ranks goals_ranked;
run;
As stated, you will have to figure out which option of TIES= works best for you.
If you don't care about ties, then just sort the data by position and goals, and take the 2nd record for each position.
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
proc rank data=have out=rankings descending ties=dense;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content