Example: Ranking Students by Height within Age

In this example, you want to rank the students in your class by age and height.
To create this example:
  1. In the Tasks section, expand the Data folder, and then double-click Rank Data. The user interface for the Rank Data task opens.
  2. On the Data tab, select the SASHELP.CLASS data set.
    Tip
    If the data set is not available from the drop-down list, click Select a table icon. In the Choose a Table window, expand the library that contains the data set that you want to use. Select the data set for the example and click OK. The selected data set should now appear in the drop-down list.
  3. Assign columns to these roles:
    Role
    Column Name
    Roles
    Columns to rank
    Height
    Additional Roles
    Rank by
    Age
  4. Open the Options tab. From the Rank order drop-down list, select Largest to smallest.
  5. To run the task, click Submit SAS Code.
The Rank Data task creates an output data set. In SAS Studio, this data set opens on the Output Data tab. This data set contains the additional rank_Height column, which shows where that student ranks within her age group. For example, in the 11-year-old age group, Joyce is ranked number 2. In the 12-year-old age group, Louise is ranked number 5.
Output Data Set Created by the Rank Data Task