Sorting tables with multiple added or nested variables
Tables with multiple added variables
When you sort a table that has multiple variables in the dimension in which you are sorting, where the variables have been added using the Add button, the elements within each variable are sorted separately. For example, the following table uses the Museums sample data set, with
Age and
Gender added on the side of the table, and
Biology and
Before on the top of the table. The rows are sorted by their values in the
Before column. To do this, you select
before{Base} from the Sort rows based on list box in the Sort tab of the Table Properties dialog box. See
Sorting a table for more information.
Here is the table, with the sort column highlighted:
Table with multiple added variables sorted on base Before column
Notice that the rows that relate to the Age variable have been sorted separately from the rows that relate to the Gender variable.
Table with multiple nested variables
If there is nesting in the dimension of the table in which the sort row or column is located, the sorting list boxes display the combined sort options. In the following nested table, the rows are sorted on the Base column of the Before variable that is nested within the Yes category of the Biology variable. To do this, you select biology{Yes} > before{Base} in the Sort rows based on list.
Here is the table, with the sort column highlighted:
Nested table sorted on base Before column
Note that the sort order would be different if you sorted the rows on the Base column of the Before variable that is nested within the No category of the Biology variable.
When you sort a table that contains nesting in the dimension in which you are sorting, the elements within the inner variables are sorted. However, the elements of the outermost variable are not sorted. For example, the following table has Education nested within Interview on the side of the table, by Gender on the top of the table. The rows of the table are sorted by the values in the base Gender column. To do this, select Gender{Base} in the Sort rows based on list.
Here is the table, with the sort column highlighted:
Nested table sorted on base Gender column; outermost variable is unsorted
Combination of added and nested variables
You cannot sort an axis that contains a combination of nested and added (concatenated) variables. However, you can use that axis to sort the other axis of the table (provided that this does not also contain both nesting and concatenation).
See also