The Sort block enables you to order a dataset based on one or more variables.
The following demonstrates how to use the Sort block to sort an input dataset lib_books.csv (which contains observations that describe a range of books available from a lending library) using the values in the Author variable:
- Import the lib_books.csv dataset onto a Workflow canvas using the Text File Import block.
- Expand the Data Preparation group in the Workflow palette, then click and drag a Sort block onto the Workflow canvas.
- Click Output port of the lib_books dataset block and drag a connection towards the Input port of the Sort block.
- Double-click the Sort block to display the Configure Sort dialog box.
- In the Configure Sort dialog box:
- In the Unselected Variables list, select Author.
- Click Select to move the variable to the Selected Variables list.
- Click OK to save the configuration and close the Configure Sort dialog box.
A green execution status is displayed in the Output ports of the Sort block and the new Working Dataset. The Sort block output dataset contains the input lib_books.csv dataset ordered by Author.