Using SPSS and PASW/Sorting Variables

One of the functions you will often want to perform in the Data View of the Data Editor is sorting by a variable's values, to bring those of similar value together. This can be a very useful when exploring the raw data in your dataset. There are two ways to do this. One is quite simple, the other allows for sorting on more than one variable.

The simple way to sort variable values is to make sure you are looking at the Data View tab. Then scroll to the variable by which you want to sort. Right click on its column heading and a context menu will appear:

At the bottom of the context menu are two sorting options: "Sort Ascending" and "Sort Descending." Choosing the first will move the smallest values to the top of the data set while a descending sort will bring up the largest values. Keep in mind that SPSS automatically (unlike Excel) moves all rows in unison, so you don't need to worry about cases becoming misaligned when sorting.

Sometimes it's useful to sort on multiple variables, which means that SPSS will sort the data set by the values of the first variable, then breaks ties in that sort by sorting on the values of the second variable, and so on.

To sort on multiple variables at once, choose "Data" -> "Sort Cases":

You'll get this dialog window:

The "Sort Order" box allows the choice between Ascending or Descending order once again. On the left is a list of all the variables in the data set. Choose them, the most important sort first, by clicking the variable involved and then the blue arrow, and repeat:

Save your data set after sorting to retain it as the default sorting.