Use this to sort the order that the labels or levels of a factor are displayed. The labels or levels can be sorted using a predefined sort type such as alphabetical, or by compass points. If the labels or levels are to be sorted into a non-standard order then the Reorder Factor Levels dialog can be used.
- Place the cursor in a factor column, then from the menu select Spread | Factor | Edit Levels and Labels.
- On the dialog that appears click Sort.
Sort type
Compass points | Sort the labels using the order of compass points (N, NE, E, etc…). |
Week days | Use the order of days of the week (Mon, Tue, Wed, etc…) to sort the labels. |
Month names (abbreviated) | Use the order of 3 letter month names (Jan, Feb, Mar, etc…) to sort the labels. |
Month names (full) | Use the order of full month names (January, February, March, etc…) to sort the labels. |
Seasons | Sort the labels using the order of seasons (winter, spring, summer and autumn). |
User order | Sort using the user order specified in Tools | Spreadsheet Options | Conversions tab. The order is set by clicking the User defined label order button. |
Alphabetical | Use an alphabetical sort order on the labels. |
By numerical part | Read any number within the label and sort numerically on these. For example the list A2, B1, 0X, Z1.2 will sort to 0X, B1, Z1.2, A2. |
Numerical suffix | Sort numerically on whole numbers at the start of the label, and then alphabetically on the remainder of the label. For example the alphabetically sorted list 100A, 10A, 10B, 1A, 1B, 20B, 2A, will sort to 1A, 1B, 10A, 10B, 100A, 2A, 20B. |
Numerical prefix | Sort alphabetically on the letters at the start of the label and then numerically on whole numbers at the end of the label. For example the list A1, A10, A100, A2, A20 will sort to A1, A2, A10, A20, A100. |
By levels | Sort numerically using the factor levels. |
By frequency | Sort according to the frequency of occurrence of each factor group in the column. |
By summary statistic | Sort according to a selected variate’s summary statistic for each factor group. The summary statistic and variate are selected using the Select Summary Statistic to Sort Levels on dialog |
The user order can be specified on the Tools | Spreadsheet Options | Conversions tab by clicking the User defined label order button. This opens the User defined Label/Level Order within a Factor dialog.
Starting position
For predefined lists (day, months, compass points or user specified) this gives the starting position in the list. The list is treated as circular, so for example with months, the first month by default is January, but by specifying a starting position of June, the months will be sorted in the order June, July, … May.
Sort direction
Selects whether the data is sorted into Ascending or Descending order.
See also
- Understanding Factors within a Spreadsheet
- User defined Label/Level Order within a Factor
- Spreadsheet Conversions Options Tab
- Spreadsheet Sort Menu
- Reorder Columns
- Reorder Factor Levels
- Select Summary Statistic to Sort Levels on
- Recode a Column
- Factor Product/Combine
- Edit Factor Levels and Labels
The FACSORT procedure can be used within the command language to provide this functionality.