- tab_box (t, TAL_1, TAL_1, -1, TAL_1, 0, 0, 5, r);
- tab_hline (t, TAL_2, 0, 5, 1);
- tab_hline (t, TAL_2, 0, 5, r);
- tab_joint_text (t, 0, r, 1, r, TAB_RIGHT | TAT_TITLE, _("Total"));
- tab_vline (t, TAL_0, 1, r, r);
- tab_double (t, 2, r, TAB_NONE, cum_freq, wfmt);
- tab_fixed (t, 3, r, TAB_NONE, 100.0, 5, 1);
- tab_fixed (t, 4, r, TAB_NONE, 100.0, 5, 1);
-
- tab_title (t, "%s", var_to_string (vf->var));
- tab_submit (t);
+ subcase_init_empty (&pt->split);
+ subcase_init_empty (&pt->dimensions[TABLE_HORZ]);
+ subcase_init_empty (&pt->dimensions[TABLE_VERT]);
+ subcase_add_var (&pt->dimensions[TABLE_VERT], value_var, SC_ASCEND);
+
+ pt->pane.n[TABLE_HORZ] = 4;
+ pt->pane.n[TABLE_VERT] = 1;
+ pt->pane.cells = xmalloc (sizeof *pt->pane.cells);
+ pt->pane.cells[0] = xmalloc (4 * sizeof **pt->pane.cells);
+
+ /* Frequency. */
+ pivot_cell_init (
+ &pt->pane.cells[0][0],
+ pivot_value_create (freq_var, PIVOT_SUM, 0, 0, PIVOT_INCLUDE_ALL));
+
+ /* Percent. */
+ pivot_cell_init (
+ &pt->pane.cells[0][1],
+ pivot_value_create (freq_var, PIVOT_SUM, 0, 0, PIVOT_INCLUDE_ALL));
+ pt->pane.cells[0][1].cmp = PIVOT_PERCENT;
+ pt->pane.cells[0][1].cmp_args[0] = pivot_value_create (
+ freq_var, PIVOT_SUM, 0, 1, PIVOT_INCLUDE_ALL);
+ pt->pane.cells[0][1].label = xstrdup ("Percent");
+
+ /* Valid Percent. */
+ pivot_cell_init (
+ &pt->pane.cells[0][2],
+ pivot_value_create (freq_var, PIVOT_SUM, 0, 0, PIVOT_INCLUDE_VALID));
+ pt->pane.cells[0][2].cmp = PIVOT_PERCENT;
+ pt->pane.cells[0][2].cmp_args[0] = pivot_value_create (
+ freq_var, PIVOT_SUM, 0, 1, PIVOT_INCLUDE_VALID);
+ pt->pane.cells[0][2].label = xstrdup ("Valid Percent");
+
+ /* Cumulative (Valid) Percent. */
+ pivot_cell_init (
+ &pt->pane.cells[0][3],
+ pivot_value_create (freq_var, PIVOT_SUM, 0, 0, PIVOT_INCLUDE_VALID));
+ pt->pane.cells[0][3].base->n_cum_vars[TABLE_VERT] = 1;
+ pt->pane.cells[0][3].cmp = PIVOT_PERCENT;
+ pt->pane.cells[0][3].cmp_args[0] = pivot_value_create (
+ freq_var, PIVOT_SUM, 0, 1, PIVOT_INCLUDE_VALID);
+ pt->pane.cells[0][3].label = xstrdup ("Cum Percent");
+
+ pivot_table_dump (pt);