Edit Factor Levels and Labels
See Also
This dialog can be used to change the attributes of a factor. The attributes are displayed in a spreadsheet containing 5 columns, as follows:

Ordinals - The order of the level/label in the factor.
Levels - The numerical level associated with each group in the factor.
Labels - The text label associated with each group in the factor.
Counts - The frequency of occurrence of group in the factor. (For information only).
Colours - The background cell colour displayed for each level of a factor.

Factor Levels and Labels dialog

You can reorder the groups in a factor by changing the ordinal values. The new ordinal values must specify a set of whole numbers from 1 to n, where n is the new number of groups for the factor. If the missing value code * entered as an ordinal, then that group will be deleted from the factor and a missing value will replace that group level in the data displayed in the spreadsheet.

The levels and labels can also be changed as required. If the labels column is empty then no text has yet been provided to describe each group. Deleting all the labels is equivalent to selecting the Clear Labels item from the Factor section of the Spread menu. If labels are used, then one must be provided for each group. If you try to specify labels for only some groups a warning message will be generated. The levels must be provided and a missing value is not valid for a level.

The colours are used as the background colour for each cell in the spreadsheet with this level for the column in that row. The background colour can be applied to any column in the spreadsheet. The colour for a level can be selected by either clicking on the colour selector icon in any cell or by double-clicking the cell. This opens the standard colour selection dialog. Selecting a colour and clicking the OK will insert the colour into the cell. The colours may also be pasted as integers (= 256*(256*Red + Green) + Blue) from the clipboard. Once set these colours can be applied to other columns using the

The cursor key movement for this menu is slightly different to a standard spreadsheet, in that the right/left arrow moves with a cell. Use the Tab and Back Tab (Shift+Tab) keys to move from column to column. The Shift key + up/down arrow & page up/down can be used to select individual cells. Alternatively, to select a group of cells, move the mouse to the top left of a cell, so that the cursor changes to the + icon, click down and drag to the end of the selection. A whole column can be selected by clicking on the column name.

The levels, labels and colours can be entered from the clipboard using the Paste button or the Ctrl+V shortcut key. The selected cells can be copied to the clipboard with the Copy button or the Ctrl+C shortcut key.

The maximum length of a factor label is 60 characters.

Add

Add a new group into the factor. An extra row will be added at the bottom of the spreadsheet.

Delete

Delete a group from the factor. The group deleted is the row which currently has focus (contains the cursor). If the group already exists (i.e. is present before this menu was opened), a missing value (*) is entered into it's ordinal column and the remaining ordinals are renumbered.

Sort

Open the Sort Label/Level Order within a Factor Column menu, which can be used to sort the levels or labels.

Copy

Copy the current cell or selected cells onto the clipboard. A whole column can be selected by clicking on the column title. A selection of cells (only what can be seen on the screen) can be made by holding the mouse over the to right corner of a cell, clicking down and dragging until the cells are selected.

Paste

Paste the contents of the clipboard from the current cell downwards.

Find

Open the Find dialog to locate specified text in the levels or labels. If the current focus is in the levels column, then the levels column will be searched for the number entered. Similarly, if the focus is in the labels column then the labels will be searched for the text entered.

<<

Move back to the previous factor in the sheet, applying any changes made in the dialog.

>>

Move forward to the next factor in the sheet, applying any changes made in the dialog.

Clear

Clear the items in the current column, or the selected columns (click the column heading to select the column). This will clear the labels and colours, and reset the levels to the default values of 1...n.

OK

Use the specified ordinals, levels and labels for the factor and close the dialog.

Cancel

Close the dialog without making any changes to the factor.

See Also

The NEWLEVELS function of CALCULATE, the FACTOR directive with option [MODIFY=yes] and the FACSORT procedure can be used within the command language to provide some of this functionality.