FORMAT
authorBen Pfaff <blp@cs.stanford.edu>
Thu, 4 Aug 2022 23:22:36 +0000 (16:22 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Thu, 4 Aug 2022 23:22:36 +0000 (16:22 -0700)
src/language/stats/ctables.c
tests/language/stats/ctables.at

index 5393c1b838b5343bc4eb71433c0246c130d26eac..f8c3f89f0d33f9688652f19c973d9f6ca1d03d3a 100644 (file)
@@ -4788,6 +4788,7 @@ ctables_table_output (struct ctables *ct, struct ctables_table *t)
                   value = pivot_value_new_number (d);
                   value->numeric.format = format;
                 }
+              /* XXX should text values be right-justified? */
               pivot_table_put (pt, dindexes, n_dindexes, value);
             }
         }
index cfa39ec3a3503af7888eb0db6cacfed9c047e6e3..0453eeb1e8ea11c7f3fae648caaadb5d4f0664cf 100644 (file)
@@ -17,7 +17,6 @@ dnl   * THRU (numeric ranges)
 dnl   * OTHERNM
 dnl - FORMAT:
 dnl   * MINCOLWIDTH, MAXCOLWIDTH, UNITS.
-dnl   * MISSING.
 dnl - HIDESMALLCOUNTS.
 dnl - Date/time variables and values
 dnl - Special formats for summary functions: NEGPAREN, NEQUAL, PAREN, PCTPAREN.
@@ -2253,4 +2252,36 @@ AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
 │                             one             │               │               │
 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
 ])
+AT_CLEANUP
+
+AT_SETUP([CTABLES FORMAT=MISSING])
+AT_KEYWORDS([FORMAT MISSING])
+AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
+AT_DATA([ctables.sps],
+[[GET 'nhtsa.sav'.
+CTABLES /FORMAT MISSING='(no data)' /TABLE qnd5a[COLPCT] BY qnd5.
+]])
+AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
+                                 Custom Tables
+╭─────────────────────────────────────────────┬───────────────────────────────╮
+│                                             │   D5. ETHNICITY: Are you of   │
+│                                             │  Hispanic or Latino origin or │
+│                                             │            descent?           │
+│                                             ├───────────────┬───────────────┤
+│                                             │      Yes      │       No      │
+│                                             ├───────────────┼───────────────┤
+│                                             │    Column %   │    Column %   │
+├─────────────────────────────────────────────┼───────────────┼───────────────┤
+│D5a. What would you say is   Cuban           │           3.2%│(no data)      │
+│your primary ethnic          Mexican         │          50.3%│(no data)      │
+│background?                  Spanish         │           7.8%│(no data)      │
+│                             South American  │           5.5%│(no data)      │
+│                             Central American│           8.4%│(no data)      │
+│                             Puerto Rican, OR│          12.6%│(no data)      │
+│                             Something else  │          11.0%│(no data)      │
+│                             Multiple -      │           1.1%│(no data)      │
+│                             cannot choose   │               │               │
+│                             one             │               │               │
+╰─────────────────────────────────────────────┴───────────────┴───────────────╯
+])
 AT_CLEANUP
\ No newline at end of file