Example: Sort the SASHELP.CLASS Data Set by Sex and Age

To create this example:
  1. In the Tasks section, expand the Data folder, and then double-click Sort Data. The user interface for the Sort 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. To the Sort by role, assign the Sex and Age columns.
  4. To run the task, click Submit SAS Code.
The newly created WORK.SortDS data set is available from the Output Data tab. In the output data, the observations are first sorted by Sex (whether Female or Male). Within each group, the observations are sorted in ascending order by age.
Content of the WORK.SortDS Data Set