Using SPSS and PASW/Sorting Variables

One of the functions you can perform in the Data View of the Data Editor is to sort by variable values. This can be a very useful tool when you are exploring the raw data in your dataset. There are two ways to do this. One is quite simple, the other allows for more complex sorting.

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 the column heading and a context menu will appear:

12sort01.png

At the bottom of the context menu are two sorting options: "Sort Ascending" and "Sort Descending." Choosing the first will move the lowest values to the top of the data set. Choosing the second will move the highest values to the top of the data set. Keep in mind that SPSS automatically (unlike Excel) moves all the other columns to retain their correspondence as a single case, so you don't need to worry about cases becoming misaligned when you do this.

The more complicated way to sort also allows for greater complexity in sorting. Choose "Data" -> "Sort Cases":

12sort02.png

You'll get this window:

12sort03.png

You'll see below the "Sort by:" box the option to sort by either Ascending or Descending order again. To the left of the window is a list of all the variables in the data set. You can select multiple variables and move them to the "Sort by:" box using the blue arrow:

12sort04.png

Sorting using multiple variables tells SPSS to sort the data set by the values of the first variable, then to sort by the values of the second variable, and so on. This, too, can be useful at times when examining your data.

Sorting data does change the data set, which means that you must save it if you want to retain the changes resulting from sorting.

Last modified on 29 June 2010, at 03:06