Sort variables
You can sort the variables in the active dataset based on the values of any of the variable attributes (e.g., variable name, data type, measurement level), including custom variable attributes.
- Values can be sorted in ascending or descending order.
- You can save the original (pre-sorted) variable order in a custom variable attribute.
- Sorting by values of custom variable attributes is limited to custom variable attributes that are currently visible in Variable View.
For more information on custom variable attributes, see Custom Variable Attributes.
To Sort Variables
In Variable View of the Data Editor:
- Right-click
the attribute column heading and from the pop-up menu choose Sort Ascending or Sort Descending.
or
- From the menus in Variable View or Data View, choose:
- Select the attribute you want to use to sort variables.
- Select the sort order (ascending or descending).
- The list of variable attributes matches the attribute column names displayed in Variable View of the Data Editor.
- You can save the original (pre-sorted) variable order in a custom variable attribute. For each variable, the value of the attribute is an integer value indicating its position prior to sorting; so by sorting variables based on the value of that custom attribute you can restore the original variable order.