Select menu: Spread | Calculate | Code to Groups
This dialog splits a numerical column into groups based on specified limits or break points and creates a factor to index these groups.
- From the menu select Spread | Calculate | Code to Groups.
- Set options as required then click OK.
Groups column name
The name of the new factor to be created. This may be the name of an existing column, in which case this column is overwritten (after a displaying a warning).
Number of groups
The number of groups for the new factor. The number of Break points that need to be specified should be one less than the number of groups, but at least 2.
Limits are lower boundaries
When selected, the first group will be defined by the values less than the first Break point (specified in the second row). The first group label is then automatically specified as < this break point. However, you can change the label if required.
When this option is not selected, the last group will be defined by the values greater than the last Break point (specified in the second to last row). The last group label is then automatically specified as > this Break point.
Break points
The Break points or limits that are used to divide the values up into groups.
Levels
The levels that are given to each group. Default values are 1…n.
Labels
The labels that are given to each group. Default values are generated from the Break points.
Counts
The number of values that will coded to each group with the current Break points. The Counts column is provided for information and cannot be changed.
Reset
Set the Break points, Levels and Labels back to their default values.
= Ranges
Calculate a set of Break points that are equally spaced over the range of the data.
=Counts
Calculate a set of Break points that divide the values into groups of equal size as close to equal counts as possible.
Copy and paste
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. You can use the Shift key + up/down arrows and Page Up/Page 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 new values can be entered from the clipboard using the keyboard shortcut Ctrl+V. You can copy the selected cells to the clipboard using the keyboard shortcut Ctrl+C.
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
Recode a Column
Factor Divide
Understanding Factors within a Spreadsheet
Reorder Factor Levels
Edit Factor Levels and Labels
Change Factor Levels and Labels
Factor Standardize Levels
Spreadsheet Calculate Menu
Edit Unicode Text
Working with Unicode in a Spreadsheet
The GROUPS directive provides this functionality within the command language.