As the first step in the decommissioning of the site has been converted to read-only mode.

Here are some tips for How to share your SAS knowledge with your professional network.

Tips:Creating an Ordered Subset using PROC RANK

From sasCommunity
Jump to: navigation, search
 proc sort data=sashelp.class
   by sex;
proc rank data=class
          out=rank5(where=(rankwt le 5))
   by sex;
   ranks rankwt;
   var weight;

Did you know that you can use PROC RANK to create subsets of observations within a group based on the value of an analysis variable? In this example we want the top 5 heaviest weights within each level of SEX. Remove the keyword DESCENDING to save the 5 lightest weights.

Adding the TIES=LOW option on the PROC RANK statement allows you to collect ties as well (you may end up with more than just the specified number of observations).

Submitted By Art Carpenter (talk)