- tab_headers (t, heading_columns, 0, heading_rows, 0);
-
- tab_box (t, TAL_2, TAL_2, -1, TAL_1, 0, 0, nc - 1, nr - 1);
-
- tab_hline (t, TAL_2, 0, nc - 1, heading_rows);
- tab_vline (t, TAL_2, heading_columns, 0, nr - 1);
-
- tab_text (t, 0, 0, TAB_LEFT | TAT_TITLE, _("Unweighted Cases"));
- tab_text (t, 1, 0, TAB_CENTER | TAT_TITLE, _("N"));
- tab_text (t, 2, 0, TAB_CENTER | TAT_TITLE, _("Percent"));
-
-
- tab_text (t, 0, 1, TAB_LEFT | TAT_TITLE, _("Included in Analysis"));
- tab_text (t, 0, 2, TAB_LEFT | TAT_TITLE, _("Missing Cases"));
- tab_text (t, 0, 3, TAB_LEFT | TAT_TITLE, _("Total"));
-
- tab_double (t, 1, 1, 0, res->n_nonmissing, &F_8_0);
- tab_double (t, 1, 2, 0, res->n_missing, &F_8_0);
-
- total = res->n_nonmissing + res->n_missing;
- tab_double (t, 1, 3, 0, total , &F_8_0);
-
- tab_double (t, 2, 1, 0, 100 * res->n_nonmissing / (double) total, 0);
- tab_double (t, 2, 2, 0, 100 * res->n_missing / (double) total, 0);
- tab_double (t, 2, 3, 0, 100 * total / (double) total, 0);
-
- tab_submit (t);
+ double total = res->n_nonmissing + res->n_missing;
+ struct entry
+ {
+ int stat_idx;
+ int case_idx;
+ double x;
+ }
+ entries[] = {
+ { 0, 0, res->n_nonmissing },
+ { 0, 1, res->n_missing },
+ { 0, 2, total },
+ { 1, 0, 100.0 * res->n_nonmissing / total },
+ { 1, 1, 100.0 * res->n_missing / total },
+ { 1, 2, 100.0 },
+ };
+ for (size_t i = 0; i < sizeof entries / sizeof *entries; i++)
+ pivot_table_put2 (table, entries[i].stat_idx, entries[i].case_idx,
+ pivot_value_new_number (entries[i].x));
+
+ pivot_table_submit (table);