all but last category
authorBen Pfaff <blp@cs.stanford.edu>
Thu, 30 Dec 2021 23:14:15 +0000 (15:14 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Sat, 2 Apr 2022 01:48:55 +0000 (18:48 -0700)
src/language/stats/ctables.c

index d3ab1a290a01f5e14244b7c332896ea2bd4d497d..96d12e03fcd4d94c4c5dbddbdf3547b315e560cf 100644 (file)
@@ -1526,9 +1526,15 @@ ctables_execute (struct dataset *ds, struct ctables *ct)
                     break;
 
               for (size_t m = n_common; m + 1 < ft->vars.n; m++)
-                groups[m] = pivot_category_create_group__ (
-                  m > 0 ? groups[m - 1] : d->root,
-                  pivot_value_new_var_value (ft->vars.vars[m], &f->values[m]));
+                {
+                  struct pivot_category *parent = m > 0 ? groups[m - 1] : d->root;
+                  if (true)
+                    parent = pivot_category_create_group__ (
+                      parent, pivot_value_new_variable (ft->vars.vars[m]));
+                  groups[m] = pivot_category_create_group__ (
+                    parent,
+                    pivot_value_new_var_value (ft->vars.vars[m], &f->values[m]));
+                }
 
               int leaf = pivot_category_create_leaf (
                 ft->vars.n > 1 ? groups[ft->vars.n - 2] : d->root,