1. Home
  2. Edit Factor Levels and Labels

Edit Factor Levels and Labels

Select menu: Spread | Factor | Edit Levels and Labels

Use this to change the attributes of a factor. The attributes are displayed in a spreadsheet containing 5 columns, as follows:

Ordinals The order of the levels/labels for 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 for each group in the factor (for information only).
Colour The background cell colour displayed for each group of the factor.
  1. From the menu select Spread | Factor | Edit Levels and Labels.

You can reorder the groups of a factor by changing the ordinal values. The ordinal values should be a whole number in the range 1 to n, where n is the new number of groups for the factor. A group can be deleted by entering a missing value code (‘*’) as an ordinal value then. If a group is deleted then a missing value will be displayed for that group in the data spreadsheet.

The level for a factor lets you store a (numerical) value to represent a group. A level can be supplied for each group of the factor but each value must be distinct between the groups. Similarly the label for a factor lets you store text to represent a group. For a factor label you can enter any text up to a maximum of 60 characters. If the cells within the labels column are empty then this means that no labels are currently representing the groups for the factor. If levels or labels are supplied they should be present for all the groups otherwise a warning message will appear.

You can select colours to specify the background colour of cells within a spreadsheet. The colour is displayed for all the cells associated with the specified group. A colour can be selected by either clicking on the colour selector icon or by double-clicking the cell which opens a colour selection dialog. After a colour has been chosen it will be displayed in the current cell. An alternative way to supply the colours is to paste an integer values from the clipboard.

In this dialog the cursor key behaves differently as compared to a standard spreadsheet where the right/left arrow moves the cursor with a cell rather than between cells. To move between columns you can use the Tab and back Tab (Shift+Tab) keys. A selection of cells can be made using the Shift key + the up/down arrow or Page Up/Down. Alternatively, you can make a selection by moving the mouse to the top left of a cell so that the cursor changes to the + icon, clicking the left mouse button and then dragging the mouse. You can select columns by clicking on the column header name.

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

Action buttons

OK Make the changes and close the dialog.
Cancel Close the dialog without making any changes.
Add Add a new group to the factor where a new row is inserted at the bottom of the sheet.
Delete Deletes a group from the factor for the row that currently has focus (i.e. contains the cursor). If the group being deleted represents a group that existed before this dialog was opened then a missing value (*) is entered into its ordinal column and the remaining ordinal values are automatically renumbered.
Sort Opens a dialog that can be used to sort the levels or labels representing the groups.
Copy Copies the contents of the current cell or a selection of cells onto the clipboard.
Paste Paste the contents on the clipboard starting from the current cell.
Find Opens the Find in Factor Levels and Labels dialog that can be used to find specified text within the levels or labels. You can search within the levels by placing the cursor in the levels column and similarly you can find text within the labels when the cursor is within the labels column.
Replace Opens the Replace in Factor Levels and Labels dialog that can be used to find and replace specified text within the levels or labels. You can search within the levels by placing the cursor in the levels column and similarly you can find text within the labels when the cursor is within the labels column.
<< Show the factor attributes for the previous factor within the spreadsheet and apply any changes made to the current factor attributes.
>> Show the factor attributes for the next factor within the spreadsheet and apply any changes made to the current factor attributes.
Clear Clears the items within the labels or colour columns. To delete the contents of the column either select the column or place the cursor within the column.

Behaviour with Unicode text in a column

When a column in the spreadsheet contains Unicode, you will not be able to edit the labels directly. An attempt to edit a cell will open the Edit Unicode Text dialog which accepts Unicode characters. You can still use the clipboard shortcut keys for copying (Ctrl+C), cutting (Ctrl+X) and pasting (Ctrl+V) Unicode text in this dialog. See Working with Unicode in a Spreadsheet for more information on working with Unicode text.

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.

Updated on January 26, 2022

Was this article helpful?