dnl Features not yet tested:
dnl - Preprocessing to distinguish categorical from scale.
-dnl - Parsing (positive and negative)
-dnl - String variables and values
dnl - Testing details of missing value handling in summaries.
-dnl - test CLABELS ROWLABELS=LAYER.
-dnl - Test VLABELS.
dnl - Test WEIGHT and adjustment weights.
-dnl - EMPTY=INCLUDE For string ranges.
dnl - Summary functions:
dnl * Separate summary functions for totals and subtotals.
dnl * )CILEVEL in summary label specification
-dnl Category sorting:
-dnl * VALUE
-dnl * LABEL
-dnl * ascending/descending
dnl - CATEGORIES:
-dnl * String values
dnl * Date values
dnl * THRU (numeric ranges)
-dnl * THRU (string ranges)
dnl * OTHERNM
-dnl - FORMAT:
-dnl * MINCOLWIDTH, MAXCOLWIDTH, UNITS.
-dnl * EMPTY.
-dnl * MISSING.
-dnl - HIDESMALLCOUNTS.
dnl - Date/time variables and values
-dnl - Special formats for summary functions: NEGPAREN, NEQUAL, PAREN, PCTPAREN.
-dnl - TITLES: )DATE, )TIME, )TABLE.
dnl - Test PCOMPUTE:
dnl * PCOMPUTE for more than one kind of summary (e.g. [COUNT, ROWPCT]).
dnl * MISSING, OTHERNM
-dnl * strings and string ranges
dnl * multi-dimensional (multiple CCT_POSTCOMPUTE in one cell)
dnl * dates
dnl - PPROPERTIES:
dnl * .SE suffixes.
dnl - CATEGORIES:
dnl * Data-dependent sorting.
-dnl
-dnl
-dnl Bug:
-dnl CTABLES /TABLE=qnd1 [MEAN, MEDIAN] BY qns3a.
-dnl produces a bad median:
-dnl Custom Tables
-dnl +--------------------------+-----------------------+
-dnl | | S3a. GENDER: |
-dnl | +-----------+-----------+
-dnl | | Male | Female |
-dnl | +----+------+----+------+
-dnl | |Mean|Median|Mean|Median|
-dnl +--------------------------+----+------+----+------+
-dnl |D1. AGE: What is your age?| 46| 999| 50| 999|
-dnl +--------------------------+----+------+----+------+
-
-
-
-# AT_SETUP([CTABLES parsing])
-# AT_DATA([ctables.sps],
-# [[DATA LIST LIST NOTABLE /x y z.
-# CTABLES /TABLE=(x + y) > z.
-# CTABLES /TABLE=(x[c] + y[c]) > z.
-# CTABLES /TABLE=(x + y) > z[c].
-# CTABLES /TABLE=x BY y BY z.
-# CTABLES /TABLE=x[c] [ROWPCT.COUNT] > y[c].
-# CTABLES /TABLE=x[c] > y[c] [ROWPCT.COUNT].
-# ]])
-# AT_CHECK([pspp ctables.sps])
-# AT_CLEANUP
+
+AT_SETUP([CTABLES parsing])
+AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
+AT_DATA([ctables.sps],
+[[GET 'nhtsa.sav'.
+CTABLES
+ /FORMAT MINCOLWIDTH=10 MAXCOLWIDTH=20 UNITS=POINTS EMPTY=ZERO MISSING="x"
+ /FORMAT MINCOLWIDTH=DEFAULT MAXCOLWIDTH=DEFAULT UNITS=INCHES EMPTY=BLANK MISSING="."
+ /FORMAT UNITS=CM EMPTY="(-)"
+ /VLABELS VARIABLES=qn1 DISPLAY=DEFAULT
+ /VLABELS VARIABLES=qn17 DISPLAY=NAME
+ /VLABELS VARIABLES=qns3a DISPLAY=LABEL
+ /VLABELS VARIABLES=qnd1 DISPLAY=BOTH
+ /VLABELS VARIABLES=qn20 DISPLAY=NONE
+ /MRSETS COUNTDUPLICATES=NO
+ /MRSETS COUNTDUPLICATES=YES
+ /SMISSING VARIABLE
+ /SMISSING LISTWISE
+ /WEIGHT VARIABLE=qns3a
+ /HIDESMALLCOUNTS
+ /HIDESMALLCOUNTS COUNT=10
+ /TABLE qnsa1
+ /SLABELS POSITION=COLUMN VISIBLE=YES
+ /SLABELS VISIBLE=NO POSITION=ROW
+ /SLABELS POSITION=LAYER
+ /CLABELS AUTO
+ /CLABELS ROWLABELS=OPPOSITE
+ /CRITERIA CILEVEL=50
+ /CATEGORIES VARIABLES=qn1 qn17
+ ORDER=A KEY=VALUE MISSING=INCLUDE TOTAL=YES LABEL="xyzzy"
+ POSITION=BEFORE EMPTY=INCLUDE.
+CTABLES /TABLE qnsa1 /CLABELS ROWLABELS=LAYER.
+CTABLES /TABLE qnsa1 /CLABELS COLLABELS=OPPOSITE.
+CTABLES /TABLE qnsa1 /CLABELS COLLABELS=LAYER.
+]])
+AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
+ Custom Tables
+Count
+╭───────────────────┬────┬────╮
+│ │ RDD│CELL│
+├───────────────────┼────┼────┤
+│Sa1. SAMPLE SOURCE:│5392│1607│
+╰───────────────────┴────┴────╯
+
+ Custom Tables
+RDD
+╭───────────────────┬─────╮
+│ │Count│
+├───────────────────┼─────┤
+│Sa1. SAMPLE SOURCE:│ 5392│
+╰───────────────────┴─────╯
+
+ Custom Tables
+╭────────────────────────┬─────╮
+│ │Count│
+├────────────────────────┼─────┤
+│Sa1. SAMPLE SOURCE: RDD │ 5392│
+│ CELL│ 1607│
+╰────────────────────────┴─────╯
+
+ Custom Tables
+╭────────────────────────┬─────╮
+│ │Count│
+├────────────────────────┼─────┤
+│Sa1. SAMPLE SOURCE: RDD │ 5392│
+│ CELL│ 1607│
+╰────────────────────────┴─────╯
+])
+AT_CLEANUP
+
+AT_SETUP([CTABLES parsing - negative])
+AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
+AT_DATA([ctables.sps],
+[[GET 'nhtsa.sav'.
+CTABLES.
+CTABLES /FORMAT MINCOLWIDTH='foo'.
+CTABLES /TABLE qn1 [**].
+CTABLES /TABLE qn1 [NOTAFUNCTION].
+CTABLES /TABLE (qn1.
+CTABLES /TABLE **.
+CTABLES /TABLE NOTAVAR.
+STRING string(A8).
+CTABLES /TABLE string[S].
+CTABLES /TABLE qn1 [PTILE 101].
+CTABLES /TABLE qn1 [MEAN F0.1].
+CTABLES /TABLE qn1 [MEAN NEGPAREN1.2].
+CTABLES /TABLE qn1 [MEAN NEGPAREN3.4].
+CTABLES /TABLE qn1 [MEAN TOTALS].
+CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
+CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [SUBTOTAL=x].
+CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO **].
+CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO THRU x].
+CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1 THRU **].
+CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['x' THRU **].
+CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&**].
+CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
+CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=PTILE(qn1, 101).
+CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1.
+CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN.
+CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 MISSING=**.
+CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 TOTAL=**.
+CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 LABEL=**.
+CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 POSITION=**.
+CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 EMPTY=**.
+CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 **.
+CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1,2,3] **.
+CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[0]).
+CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[1**]).
+CTABLES /PCOMPUTE &k=EXPR([LO **]).
+CTABLES /PCOMPUTE &k=EXPR([LO THRU **]).
+CTABLES /PCOMPUTE &k=EXPR([1 THRU **]).
+CTABLES /PCOMPUTE &k=EXPR([1**]).
+CTABLES /PCOMPUTE &k=EXPR((1x)).
+CTABLES /PCOMPUTE **k.
+CTABLES /PCOMPUTE &1.
+CTABLES /PCOMPUTE &k**.
+CTABLES /PCOMPUTE &k=**.
+CTABLES /PCOMPUTE &k=EXPR**.
+CTABLES /PCOMPUTE &k=EXPR(1x).
+CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
+CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=NOTAFUNCTION.
+CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=PTILE **.
+CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k LABEL=**.
+CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k HIDESOURCECATS=**.
+CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k **.
+CTABLES /FORMAT EMPTY=**.
+CTABLES /FORMAT MISSING=**.
+CTABLES /FORMAT **.
+CTABLES /FORMAT MINCOLWIDTH=20 MAXCOLWIDTH=10/.
+CTABLES /VLABELS **.
+CTABLES /VLABELS VARIABLES=NOTAVAR.
+CTABLES /VLABELS VARIABLES=qn1 **.
+CTABLES /VLABELS VARIABLES=qn1 DISPLAY=**.
+CTABLES /MRSETS **.
+CTABLES /MRSETS COUNTDUPLICATES=**.
+CTABLES /SMISSING **.
+CTABLES /WEIGHT **.
+CTABLES /WEIGHT VARIABLE=NOTAVAR.
+CTABLES /HIDESMALLCOUNTS COUNT=1.
+CTABLES /QUUX.
+CTABLES /HIDESMALLCOUNTS COUNT=2.
+CTABLES /TABLE qn1**.
+CTABLES /TABLE qn1 /SLABELS POSITION=**.
+CTABLES /TABLE qn1 /SLABELS VISIBLE=**.
+CTABLES /TABLE qn1 /SLABELS **.
+CTABLES /TABLE qn1 /CLABELS ROWLABELS=**.
+CTABLES /TABLE qn1 /CLABELS COLLABELS=**.
+CTABLES /TABLE qn1 /CLABELS **.
+CTABLES /TABLE qn1 /CRITERIA **.
+CTABLES /TABLE qn1 /CRITERIA CILEVEL=101.
+CTABLES /TABLE qn1 /TITLES **.
+CTABLES /TABLE qn1 /SIGTEST TYPE=**.
+CTABLES /TABLE qn1 /SIGTEST ALPHA=**.
+CTABLES /TABLE qn1 /SIGTEST INCLUDEMRSETS=**.
+CTABLES /TABLE qn1 /SIGTEST CATEGORIES=**.
+CTABLES /TABLE qn1 /SIGTEST **.
+CTABLES /TABLE qn1 /COMPARETEST TYPE=**.
+CTABLES /TABLE qn1 /COMPARETEST ALPHA=**.
+CTABLES /TABLE qn1 /COMPARETEST ALPHA=0,5.
+CTABLES /TABLE qn1 /COMPARETEST ADJUST=**.
+CTABLES /TABLE qn1 /COMPARETEST INCLUDEMRSETS=**.
+CTABLES /TABLE qn1 /COMPARETEST MEANSVARIANCE=**.
+CTABLES /TABLE qn1 /COMPARETEST CATEGORIES=**.
+CTABLES /TABLE qn1 /COMPARETEST MERGE=**.
+CTABLES /TABLE qn1 /COMPARETEST STYLE=**.
+CTABLES /TABLE qn1 /COMPARETEST SHOWSIG=**.
+CTABLES /TABLE qn1 /COMPARETEST **.
+CTABLES /TABLE qn1 / **.
+CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CLABELS COLLABELS=OPPOSITE.
+CTABLES /TABLE qn20 > qnd1.
+CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
+NUMERIC datetime (DATETIME17.0).
+CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
+]])
+AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
+[[ctables.sps:2.8: error: CTABLES: Syntax error at end of command: expecting `/'.
+
+ctables.sps:3.29-3.33: error: CTABLES: Syntax error at `'foo'': Expected non-
+negative number for MINCOLWIDTH.
+
+ctables.sps:4.21-4.22: error: CTABLES: Syntax error at `**': expecting
+identifier.
+
+ctables.sps:5.21-5.32: error: CTABLES: Syntax error at `NOTAFUNCTION': Expecting
+summary function name.
+
+ctables.sps:6.20: error: CTABLES: Syntax error at end of command: expecting `@:}@'.
+
+ctables.sps:7.16-7.17: error: CTABLES: Syntax error at `**': expecting
+identifier.
+
+ctables.sps:8: error: CTABLES: NOTAVAR is not a variable name.
+
+ctables.sps:10.16-10.24: error: CTABLES: Cannot use string variable string as a
+scale variable.
+ 10 | CTABLES /TABLE string[S].
+ | ^~~~~~~~~
+
+ctables.sps:11.27-11.29: error: CTABLES: Syntax error at `101': Expected number
+between 0 and 100 for PTILE.
+
+ctables.sps:12: error: CTABLES: Output format F0.1 specifies width 0, but F
+requires a width between 1 and 40.
+
+ctables.sps:13.26-13.36: error: CTABLES: Syntax error at `NEGPAREN1.2': Output
+format NEGPAREN requires width 2 or greater.
+
+ctables.sps:14.26-14.36: error: CTABLES: Syntax error at `NEGPAREN3.4': Output
+format NEGPAREN requires width greater than decimals.
+
+ctables.sps:15.21-15.24: error: CTABLES: Summary function MEAN applies only to
+scale variables.
+ 15 | CTABLES /TABLE qn1 [MEAN TOTALS].
+ | ^~~~
+
+ctables.sps:15.16-15.18: note: CTABLES: 'QN1' is not a scale variable.
+ 15 | CTABLES /TABLE qn1 [MEAN TOTALS].
+ | ^~~
+
+ctables.sps:15.32: error: CTABLES: Syntax error at `@:>@': expecting `@<:@'.
+
+ctables.sps:16.21-16.24: error: CTABLES: Summary function MEAN applies only to
+scale variables.
+ 16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
+ | ^~~~
+
+ctables.sps:16.16-16.18: note: CTABLES: 'QN1' is not a scale variable.
+ 16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
+ | ^~~
+
+ctables.sps:16.40: error: CTABLES: Syntax error at `%': expecting `@:>@'.
+
+ctables.sps:17.56: error: CTABLES: Syntax error at `x': expecting string.
+
+ctables.sps:18.50-18.51: error: CTABLES: Syntax error at `**': expecting THRU.
+
+ctables.sps:19.55: error: CTABLES: Syntax error at `x': expecting number.
+
+ctables.sps:20.54-20.55: error: CTABLES: Syntax error at `**': expecting number.
+
+ctables.sps:21.56-21.57: error: CTABLES: Syntax error at `**': expecting string.
+
+ctables.sps:22.48-22.49: error: CTABLES: Syntax error at `**': expecting
+identifier.
+
+ctables.sps:23.47-23.48: error: CTABLES: Unknown postcompute &x.
+ 23 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
+ | ^~
+
+ctables.sps:24.61-24.63: error: CTABLES: Syntax error at `101': Expected number
+between 0 and 100 for PTILE.
+
+ctables.sps:25.58: error: CTABLES: Syntax error at end of command: expecting
+`@:}@'.
+
+ctables.sps:26.54: error: CTABLES: Syntax error at end of command: expecting
+`@{:@'.
+
+ctables.sps:27.54-27.55: error: CTABLES: Syntax error at `**': expecting INCLUDE
+or EXCLUDE.
+
+ctables.sps:28.52-28.53: error: CTABLES: Syntax error at `**': expecting YES or
+NO.
+
+ctables.sps:29.52-29.53: error: CTABLES: Syntax error at `**': expecting string.
+
+ctables.sps:30.55-30.56: error: CTABLES: Syntax error at `**': expecting BEFORE
+or AFTER.
+
+ctables.sps:31.52-31.53: error: CTABLES: Syntax error at `**': expecting INCLUDE
+or EXCLUDE.
+
+ctables.sps:32.46-32.47: error: CTABLES: Syntax error at `**': expecting ORDER,
+KEY, MISSING, TOTAL, LABEL, POSITION, or EMPTY.
+
+ctables.sps:33.54-33.55: error: CTABLES: Syntax error at `**': expecting TOTAL,
+LABEL, POSITION, or EMPTY.
+
+ctables.sps:34.36: error: CTABLES: Syntax error at `0': Expected positive
+integer for SUBTOTAL.
+
+ctables.sps:35.37-35.38: error: CTABLES: Syntax error at `**': expecting `@:>@'.
+
+ctables.sps:36.31-36.32: error: CTABLES: Syntax error at `**': expecting THRU.
+
+ctables.sps:37.36-37.37: error: CTABLES: Syntax error at `**': expecting number.
+
+ctables.sps:38.35-38.36: error: CTABLES: Syntax error at `**': expecting number.
+
+ctables.sps:39.29-39.30: error: CTABLES: Syntax error at `**': expecting `@:>@'.
+
+ctables.sps:40.29: error: CTABLES: Syntax error at `x': expecting `@:}@'.
+
+ctables.sps:41.19-41.20: error: CTABLES: Syntax error at `**': expecting &.
+
+ctables.sps:42.20: error: CTABLES: Syntax error at `1': expecting identifier.
+
+ctables.sps:43.21-43.22: error: CTABLES: Syntax error at `**': expecting `='.
+
+ctables.sps:44.22-44.23: error: CTABLES: Syntax error at `**': expecting EXPR.
+
+ctables.sps:45.26-45.27: error: CTABLES: Syntax error at `**': expecting `('.
+
+ctables.sps:46.28: error: CTABLES: Syntax error at `x': expecting `)'.
+
+ctables.sps:47.31-47.49: warning: CTABLES: New definition of &k will override
+the previous definition.
+ 47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
+ | ^~~~~~~~~~~~~~~~~~~
+
+ctables.sps:47.10-47.28: note: CTABLES: This is the previous definition.
+ 47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
+ | ^~~~~~~~~~~~~~~~~~~
+
+ctables.sps:47.50: error: CTABLES: Syntax error at end of command: expecting
+`/'.
+
+ctables.sps:48.53-48.64: error: CTABLES: Syntax error at `NOTAFUNCTION':
+Expecting summary function name.
+
+ctables.sps:49.59-49.60: error: CTABLES: Syntax error at `**': Expected number
+between 0 and 100 for PTILE.
+
+ctables.sps:50.52-50.53: error: CTABLES: Syntax error at `**': expecting string.
+
+ctables.sps:51.61-51.62: error: CTABLES: Syntax error at `**': expecting YES or
+NO.
+
+ctables.sps:52.46-52.47: error: CTABLES: Syntax error at `**': expecting LABEL,
+FORMAT, or HIDESOURCECATS.
+
+ctables.sps:53.23-53.24: error: CTABLES: Syntax error at `**': expecting string.
+
+ctables.sps:54.25-54.26: error: CTABLES: Syntax error at `**': expecting string.
+
+ctables.sps:55.17-55.18: error: CTABLES: Syntax error at `**': expecting
+MINCOLWIDTH, MAXCOLWIDTH, UNITS, EMPTY, or MISSING.
+
+ctables.sps:56: error: CTABLES: MINCOLWIDTH must not be greater than
+MAXCOLWIDTH.
+
+ctables.sps:57.18-57.19: error: CTABLES: Syntax error at `**': expecting
+VARIABLES.
+
+ctables.sps:58: error: CTABLES: NOTAVAR is not a variable name.
+
+ctables.sps:59.32-59.33: error: CTABLES: Syntax error at `**': expecting
+DISPLAY.
+
+ctables.sps:60.40-60.41: error: CTABLES: Syntax error at `**': expecting
+DEFAULT, NAME, LABEL, BOTH, or NONE.
+
+ctables.sps:61.17-61.18: error: CTABLES: Syntax error at `**': expecting
+COUNTDUPLICATES.
+
+ctables.sps:62.33-62.34: error: CTABLES: Syntax error at `**': expecting YES or
+NO.
+
+ctables.sps:63.19-63.20: error: CTABLES: Syntax error at `**': expecting
+VARIABLE or LISTWISE.
+
+ctables.sps:64.17-64.18: error: CTABLES: Syntax error at `**': expecting
+VARIABLE.
+
+ctables.sps:65: error: CTABLES: NOTAVAR is not a variable name.
+
+ctables.sps:66.32: error: CTABLES: Syntax error at `1': Expected integer 2 or
+greater for HIDESMALLCOUNTS COUNT.
+
+ctables.sps:67.10-67.13: error: CTABLES: Syntax error at `QUUX': expecting
+FORMAT, VLABELS, MRSETS, SMISSING, PCOMPUTE, PPROPERTIES, WEIGHT,
+HIDESMALLCOUNTS, or TABLE.
+
+ctables.sps:68.33: error: CTABLES: Syntax error at end of command: expecting
+`/'.
+
+ctables.sps:69.19-69.20: error: CTABLES: Syntax error at `**': expecting `/'.
+
+ctables.sps:70.38-70.39: error: CTABLES: Syntax error at `**': expecting COLUMN,
+ROW, or LAYER.
+
+ctables.sps:71.37-71.38: error: CTABLES: Syntax error at `**': expecting YES or
+NO.
+
+ctables.sps:72.29-72.30: error: CTABLES: Syntax error at `**': expecting
+POSITION or VISIBLE.
+
+ctables.sps:73.39-73.40: error: CTABLES: Syntax error at `**': expecting
+OPPOSITE or LAYER.
+
+ctables.sps:74.39-74.40: error: CTABLES: Syntax error at `**': expecting
+OPPOSITE or LAYER.
+
+ctables.sps:75.29-75.30: error: CTABLES: Syntax error at `**': expecting AUTO,
+ROWLABELS, or COLLABELS.
+
+ctables.sps:76.30-76.31: error: CTABLES: Syntax error at `**': expecting
+CILEVEL.
+
+ctables.sps:77.38-77.40: error: CTABLES: Syntax error at `101': Expected number
+in @<:@0,100@:}@ for CILEVEL.
+
+ctables.sps:78.28-78.29: error: CTABLES: Syntax error at `**': expecting
+CAPTION, CORNER, or TITLE.
+
+ctables.sps:79.34-79.35: error: CTABLES: Syntax error at `**': expecting
+CHISQUARE.
+
+ctables.sps:80.35-80.36: error: CTABLES: Syntax error at `**': Expected number
+in @<:@0,1@:}@ for ALPHA.
+
+ctables.sps:81.43-81.44: error: CTABLES: Syntax error at `**': expecting YES or
+NO.
+
+ctables.sps:82.40-82.41: error: CTABLES: Syntax error at `**': expecting
+ALLVISIBLE or SUBTOTALS.
+
+ctables.sps:83.29-83.30: error: CTABLES: Syntax error at `**': expecting TYPE,
+ALPHA, INCLUDEMRSETS, or CATEGORIES.
+
+ctables.sps:84.38-84.39: error: CTABLES: Syntax error at `**': expecting PROP or
+MEAN.
+
+ctables.sps:85.39-85.40: error: CTABLES: Syntax error at `**': Expected number
+in (0,1) for ALPHA.
+
+ctables.sps:86.39: error: CTABLES: Syntax error at `0': Expected number in (0,1)
+for ALPHA.
+
+ctables.sps:87.40-87.41: error: CTABLES: Syntax error at `**': expecting
+BONFERRONI, BH, or NONE.
+
+ctables.sps:88.47-88.48: error: CTABLES: Syntax error at `**': expecting YES or
+NO.
+
+ctables.sps:89.47-89.48: error: CTABLES: Syntax error at `**': expecting ALLCATS
+or TESTEDCATS.
+
+ctables.sps:90.44-90.45: error: CTABLES: Syntax error at `**': expecting
+ALLVISIBLE or SUBTOTALS.
+
+ctables.sps:91.39-91.40: error: CTABLES: Syntax error at `**': expecting YES or
+NO.
+
+ctables.sps:92.39-92.40: error: CTABLES: Syntax error at `**': expecting APA or
+SIMPLE.
+
+ctables.sps:93.41-93.42: error: CTABLES: Syntax error at `**': expecting YES or
+NO.
+
+ctables.sps:94.33-94.34: error: CTABLES: Syntax error at `**': expecting TYPE,
+ALPHA, ADJUST, INCLUDEMRSETS, MEANSVARIANCE, CATEGORIES, MERGE, STYLE, or
+SHOWSIG.
+
+ctables.sps:95.22-95.23: error: CTABLES: Syntax error at `**': expecting TABLE,
+SLABELS, CLABELS, CRITERIA, CATEGORIES, TITLES, SIGTEST, or COMPARETEST.
+
+ctables.sps:96: error: CTABLES: ROWLABELS and COLLABELS may not both be
+specified.
+
+ctables.sps:97.16-97.26: error: CTABLES: Cannot nest scale variables.
+ 97 | CTABLES /TABLE qn20 > qnd1.
+ | ^~~~~~~~~~~
+
+ctables.sps:97.16-97.19: note: CTABLES: This is an outer scale variable.
+ 97 | CTABLES /TABLE qn20 > qnd1.
+ | ^~~~
+
+ctables.sps:97.23-97.26: note: CTABLES: This is an inner scale variable.
+ 97 | CTABLES /TABLE qn20 > qnd1.
+ | ^~~~
+
+ctables.sps:98.16-98.35: error: CTABLES: Summaries may only be requested for
+categorical variables at the innermost nesting level.
+ 98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
+ | ^~~~~~~~~~~~~~~~~~~~
+
+ctables.sps:98.16-98.18: note: CTABLES: This outer categorical variable has a
+summary.
+ 98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
+ | ^~~
+
+ctables.sps:100.52-100.56: error: CTABLES: Failed to parse category
+specification as format DATETIME: Day (123) must be between 1 and 31..
+ 100 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
+ | ^~~~~
+]])
+AT_CLEANUP
+
+AT_SETUP([CTABLES parsing - more negative])
+AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
+AT_DATA([ctables.sps],
+[[GET 'nhtsa.sav'.
+CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
+CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
+CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
+
+STRING string(A8).
+CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
+CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
+
+CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1).
+
+CTABLES /TABLE qnd1 /CLABELS ROWLABELS=OPPOSITE.
+CTABLES /TABLE qn1 + string /CLABELS ROWLABELS=OPPOSITE.
+CTABLES /TABLE qn1 + qnsa1 /CLABELS ROWLABELS=OPPOSITE.
+CTABLES /TABLE qn105ba + qn105bb /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn105ba [1,2,3].
+
+CTABLES /PCOMPUTE &x=EXPR(1**2**3).
+CTABLES /PCOMPUTE &x=EXPR([**]).
+CTABLES /PCOMPUTE &x=EXPR(**).
+
+CTABLES /TABLE.
+
+CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
+]])
+AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
+[[ctables.sps:2.76-2.78: error: CTABLES: Computed category &pc references a
+category not included in the category list.
+ 2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
+VARIABLES=qn1 [&pc].
+ |
+^~~
+
+ctables.sps:2.28-2.35: note: CTABLES: This is the missing category.
+ 2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
+VARIABLES=qn1 [&pc].
+ | ^~~~~~~~
+
+ctables.sps:2.76-2.79: note: CTABLES: To fix the problem, add subtotals to the
+list of categories here.
+ 2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
+VARIABLES=qn1 [&pc].
+ |
+^~~~
+
+ctables.sps:3.73-3.75: error: CTABLES: Computed category &pc references a
+category not included in the category list.
+ 3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
+[&pc].
+ |
+^~~
+
+ctables.sps:3.28-3.32: note: CTABLES: This is the missing category.
+ 3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
+[&pc].
+ | ^~~~~
+
+ctables.sps:3: note: CTABLES: To fix the problem, add TOTAL=YES to the
+variable's CATEGORIES specification.
+
+ctables.sps:4.76-4.99: error: CTABLES: These categories include 2 instances of
+SUBTOTAL or HSUBTOTAL, so references from computed categories must refer to
+subtotals by position, e.g. SUBTOTAL[1].
+ 4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
+VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
+ |
+^~~~~~~~~~~~~~~~~~~~~~~~
+
+ctables.sps:4.28-4.35: note: CTABLES: This is the reference that lacks a
+position.
+ 4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
+VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
+ | ^~~~~~~~
+
+ctables.sps:7.47-7.54: error: CTABLES: This category specification may be
+applied only to string variables, but this subcommand tries to apply it to
+numeric variable QN1.
+ 7 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
+ | ^~~~~~~~
+
+ctables.sps:8.53: error: CTABLES: This category specification may be applied
+only to numeric variables, but this subcommand tries to apply it to string
+variable string.
+ 8 | CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
+ | ^
+
+ctables.sps:10: error: CTABLES: ROWLABELS=OPPOSITE is not allowed with sorting
+based on a summary function.
+
+ctables.sps:12: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
+moved to be categorical, but qnd1 is a scale variable.
+
+ctables.sps:13: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
+moved to have the same width, but QN1 has width 0 and string has width 8.
+
+ctables.sps:14: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
+moved to have the same value labels, but QN1 and QNSA1 have different value
+labels.
+
+ctables.sps:15: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
+moved to have the same category specifications, but QN105BA and QN105BB have
+different category specifications.
+
+ctables.sps:17.27-17.33: warning: CTABLES: The exponentiation operator (`**') is
+left-associative: `a**b**c' equals `(a**b)**c', not `a**(b**c)'. To disable
+this warning, insert parentheses.
+ 17 | CTABLES /PCOMPUTE &x=EXPR(1**2**3).
+ | ^~~~~~~
+
+ctables.sps:17.35: error: CTABLES: Syntax error at end of command: expecting
+`/'.
+
+ctables.sps:18.28-18.29: error: CTABLES: Syntax error at `**'.
+
+ctables.sps:19.27-19.28: error: CTABLES: Syntax error at `**'.
+
+ctables.sps:21.15: error: CTABLES: Syntax error at end of command: At least one
+variable must be specified.
+
+ctables.sps:23: error: CTABLES: Summaries may appear only on one axis.
+
+ctables.sps:23.50-23.54: note: CTABLES: This variable on the layers axis has a
+summary.
+ 23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
+ | ^~~~~
+
+ctables.sps:23.16-23.20: note: CTABLES: This variable on the rows axis has a
+summary.
+ 23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
+ | ^~~~~
+
+ctables.sps:23.33-23.37: note: CTABLES: This variable on the columns axis has a
+summary.
+ 23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
+ | ^~~~~
+
+ctables.sps:23.33-23.37: note: CTABLES: This is a scale variable, so it always
+has a summary even if the syntax does not explicitly specify one.
+ 23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
+ | ^~~~~
+]])
+AT_CLEANUP
AT_SETUP([CTABLES one categorical variable])
AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
])
AT_CLEANUP
+AT_SETUP([CTABLES one string variable])
+AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
+AT_DATA([ctables.sps],
+[[GET 'nhtsa.sav'.
+STRING licensed(A8).
+MISSING VALUES licensed('DontKnow', 'Refused').
+RECODE qnd7a(1='Yes')(2='No')(3='DontKnow')(4='Refused') INTO licensed.
+CTABLES /TABLE licensed.
+CTABLES /TABLE licensed [COUNT, TOTALS[COUNT, VALIDN]] /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
+CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'No'] TOTAL=YES.
+* Notice that the string matching is case-sensitive.
+CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'no'] TOTAL=YES.
+CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['No' THRU 'yes'] TOTAL=YES.
+CTABLES
+ /PCOMPUTE ¬yes=EXPR(['No']+['DontKnow']+['Refused'])
+ /PPROPERTIES ¬yes LABEL='Not Yes' HIDESOURCECATS=YES
+ /TABLE licensed
+ /CATEGORIES VARIABLES=licensed ['Yes', ¬yes, 'No', 'DontKnow', 'Refused'].
+CTABLES
+ /PCOMPUTE ¬yes=EXPR(['DontKnow' THRU 'No'] + ['Refused'])
+ /PPROPERTIES ¬yes LABEL='Not Yes' HIDESOURCECATS=YES
+ /TABLE licensed
+ /CATEGORIES VARIABLES=licensed ['Yes', ¬yes, 'DontKnow' THRU 'No', 'Refused'].
+]])
+AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
+ Custom Tables
+╭────────────┬─────╮
+│ │Count│
+├────────────┼─────┤
+│licensed No │ 572│
+│ Yes│ 6379│
+╰────────────┴─────╯
+
+ Custom Tables
+╭─────────────────┬─────┬───────╮
+│ │Count│Valid N│
+├─────────────────┼─────┼───────┤
+│licensed DontKnow│ 4│ │
+│ No │ 572│ │
+│ Refused │ 44│ │
+│ Yes │ 6379│ │
+│ Total │ 6999│ 6951│
+╰─────────────────┴─────┴───────╯
+
+ Custom Tables
+╭──────────────┬─────╮
+│ │Count│
+├──────────────┼─────┤
+│licensed Yes │ 6379│
+│ No │ 572│
+│ Total│ 6951│
+╰──────────────┴─────╯
+
+ Custom Tables
+╭──────────────┬─────╮
+│ │Count│
+├──────────────┼─────┤
+│licensed Yes │ 6379│
+│ no │ 0│
+│ Total│ 6379│
+╰──────────────┴─────╯
+
+ Custom Tables
+╭────────────────┬─────╮
+│ │Count│
+├────────────────┼─────┤
+│licensed No │ 572│
+│ Refused│ 44│
+│ Yes │ 6379│
+│ Total │ 6995│
+╰────────────────┴─────╯
+
+ Custom Tables
+╭────────────────┬─────╮
+│ │Count│
+├────────────────┼─────┤
+│licensed Yes │ 6379│
+│ Not Yes│ 620│
+╰────────────────┴─────╯
+
+ Custom Tables
+╭────────────────┬─────╮
+│ │Count│
+├────────────────┼─────┤
+│licensed Yes │ 6379│
+│ Not Yes│ 620│
+╰────────────────┴─────╯
+])
+AT_CLEANUP
+
AT_SETUP([CTABLES one scale variable])
AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
AT_DATA([ctables.sps],
])
AT_CLEANUP
+AT_SETUP([CTABLES sorting categories])
+AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
+AT_DATA([ctables.sps],
+[[GET 'nhtsa.sav'.
+IF (QND5A=6) QND5A=-1.
+IF (QND5A=5) QND5A=-2.
+CTABLES /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=VALUE ORDER=A
+ /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=VALUE ORDER=D
+ /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=LABEL ORDER=A
+ /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=LABEL ORDER=D.
+]])
+AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
+ Custom Tables
+╭────────────────────────────────────────────────────────────────────────┬─────╮
+│ │Count│
+├────────────────────────────────────────────────────────────────────────┼─────┤
+│D5a. What would you say is your primary ethnic -2.00 │ 52│
+│background? -1.00 │ 78│
+│ Cuban │ 20│
+│ Mexican │ 311│
+│ Spanish │ 48│
+│ South American │ 34│
+│ Central American │ 0│
+│ Puerto Rican, OR │ 0│
+│ Something else │ 68│
+│ Multiple - cannot choose│ 7│
+│ one │ │
+╰────────────────────────────────────────────────────────────────────────┴─────╯
+
+ Custom Tables
+╭────────────────────────────────────────────────────────────────────────┬─────╮
+│ │Count│
+├────────────────────────────────────────────────────────────────────────┼─────┤
+│D5a. What would you say is your primary ethnic Multiple - cannot choose│ 7│
+│background? one │ │
+│ Something else │ 68│
+│ Puerto Rican, OR │ 0│
+│ Central American │ 0│
+│ South American │ 34│
+│ Spanish │ 48│
+│ Mexican │ 311│
+│ Cuban │ 20│
+│ -1.00 │ 78│
+│ -2.00 │ 52│
+╰────────────────────────────────────────────────────────────────────────┴─────╯
+
+ Custom Tables
+╭────────────────────────────────────────────────────────────────────────┬─────╮
+│ │Count│
+├────────────────────────────────────────────────────────────────────────┼─────┤
+│D5a. What would you say is your primary ethnic Central American │ 0│
+│background? Cuban │ 20│
+│ Mexican │ 311│
+│ Multiple - cannot choose│ 7│
+│ one │ │
+│ Puerto Rican, OR │ 0│
+│ Something else │ 68│
+│ South American │ 34│
+│ Spanish │ 48│
+│ -2.00 │ 52│
+│ -1.00 │ 78│
+╰────────────────────────────────────────────────────────────────────────┴─────╯
+
+ Custom Tables
+╭────────────────────────────────────────────────────────────────────────┬─────╮
+│ │Count│
+├────────────────────────────────────────────────────────────────────────┼─────┤
+│D5a. What would you say is your primary ethnic Spanish │ 48│
+│background? South American │ 34│
+│ Something else │ 68│
+│ Puerto Rican, OR │ 0│
+│ Multiple - cannot choose│ 7│
+│ one │ │
+│ Mexican │ 311│
+│ Cuban │ 20│
+│ Central American │ 0│
+│ -1.00 │ 78│
+│ -2.00 │ 52│
+╰────────────────────────────────────────────────────────────────────────┴─────╯
+])
+AT_CLEANUP
+
AT_SETUP([CTABLES simple nesting])
AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
AT_DATA([ctables.sps],
AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
AT_DATA([ctables.sps],
[[GET 'nhtsa.sav'.
+CTABLES /TABLE AgeGroup BY qns3a.
CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=OPPOSITE.
CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=OPPOSITE.
+CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=LAYER.
+CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=LAYER.
]])
-AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
+pwd
+AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
+ Custom Tables
+╭───────────────────────┬────────────╮
+│ │S3a. GENDER:│
+│ ├─────┬──────┤
+│ │ Male│Female│
+│ ├─────┼──────┤
+│ │Count│ Count│
+├───────────────────────┼─────┼──────┤
+│Age group 15 or younger│ 0│ 0│
+│ 16 to 25 │ 594│ 505│
+│ 26 to 35 │ 476│ 491│
+│ 36 to 45 │ 489│ 548│
+│ 46 to 55 │ 526│ 649│
+│ 56 to 65 │ 516│ 731│
+│ 66 or older │ 531│ 943│
+╰───────────────────────┴─────┴──────╯
+
Custom Tables
╭───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ │ S3a. GENDER: │
│ 66 or older Male │ 531│
│ Female│ 943│
╰──────────────────────────────┴────────────╯
+
+ Custom Tables
+15 or younger
+╭─────────┬────────────╮
+│ │S3a. GENDER:│
+│ ├─────┬──────┤
+│ │ Male│Female│
+│ ├─────┼──────┤
+│ │Count│ Count│
+├─────────┼─────┼──────┤
+│Age group│ 0│ 0│
+╰─────────┴─────┴──────╯
+
+ Custom Tables
+16 to 25
+╭─────────┬────────────╮
+│ │S3a. GENDER:│
+│ ├─────┬──────┤
+│ │ Male│Female│
+│ ├─────┼──────┤
+│ │Count│ Count│
+├─────────┼─────┼──────┤
+│Age group│ 594│ 505│
+╰─────────┴─────┴──────╯
+
+ Custom Tables
+26 to 35
+╭─────────┬────────────╮
+│ │S3a. GENDER:│
+│ ├─────┬──────┤
+│ │ Male│Female│
+│ ├─────┼──────┤
+│ │Count│ Count│
+├─────────┼─────┼──────┤
+│Age group│ 476│ 491│
+╰─────────┴─────┴──────╯
+
+ Custom Tables
+36 to 45
+╭─────────┬────────────╮
+│ │S3a. GENDER:│
+│ ├─────┬──────┤
+│ │ Male│Female│
+│ ├─────┼──────┤
+│ │Count│ Count│
+├─────────┼─────┼──────┤
+│Age group│ 489│ 548│
+╰─────────┴─────┴──────╯
+
+ Custom Tables
+46 to 55
+╭─────────┬────────────╮
+│ │S3a. GENDER:│
+│ ├─────┬──────┤
+│ │ Male│Female│
+│ ├─────┼──────┤
+│ │Count│ Count│
+├─────────┼─────┼──────┤
+│Age group│ 526│ 649│
+╰─────────┴─────┴──────╯
+
+ Custom Tables
+56 to 65
+╭─────────┬────────────╮
+│ │S3a. GENDER:│
+│ ├─────┬──────┤
+│ │ Male│Female│
+│ ├─────┼──────┤
+│ │Count│ Count│
+├─────────┼─────┼──────┤
+│Age group│ 516│ 731│
+╰─────────┴─────┴──────╯
+
+ Custom Tables
+66 or older
+╭─────────┬────────────╮
+│ │S3a. GENDER:│
+│ ├─────┬──────┤
+│ │ Male│Female│
+│ ├─────┼──────┤
+│ │Count│ Count│
+├─────────┼─────┼──────┤
+│Age group│ 531│ 943│
+╰─────────┴─────┴──────╯
+
+ Custom Tables
+Male
+╭───────────────────────┬────────────╮
+│ │S3a. GENDER:│
+│ ├────────────┤
+│ │ Count │
+├───────────────────────┼────────────┤
+│Age group 15 or younger│ 0│
+│ 16 to 25 │ 594│
+│ 26 to 35 │ 476│
+│ 36 to 45 │ 489│
+│ 46 to 55 │ 526│
+│ 56 to 65 │ 516│
+│ 66 or older │ 531│
+╰───────────────────────┴────────────╯
+
+ Custom Tables
+Female
+╭───────────────────────┬────────────╮
+│ │S3a. GENDER:│
+│ ├────────────┤
+│ │ Count │
+├───────────────────────┼────────────┤
+│Age group 15 or younger│ 0│
+│ 16 to 25 │ 505│
+│ 26 to 35 │ 491│
+│ 36 to 45 │ 548│
+│ 46 to 55 │ 649│
+│ 56 to 65 │ 731│
+│ 66 or older │ 943│
+╰───────────────────────┴────────────╯
])
AT_CLEANUP
MISSING VALUES x (1, 2) y (2, 3).
VARIABLE LEVEL ALL (NOMINAL).
-CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
+CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
+ TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
/CATEGORIES VARIABLES=ALL TOTAL=YES.
-CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
+CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
+ TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
/CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
-CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
+CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
+ TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
/CATEGORIES VARIABLES=ALL TOTAL=YES
/SLABELS POSITION=ROW.
-CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
+CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
+ TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
/CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE
/SLABELS POSITION=ROW.
-CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
+CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
+ TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
/CATEGORIES VARIABLES=x [1, 2, 3, 4] TOTAL=YES
/CATEGORIES VARIABLES=y [1, 3, 4, 5] TOTAL=YES
/SLABELS POSITION=ROW.
╰────────┴─────╯
])
AT_CLEANUP
+
+AT_SETUP([CTABLES VLABELS])
+AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
+AT_DATA([ctables.sps],
+[[GET 'nhtsa.sav'.
+CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=DEFAULT /TABLE qnd5a BY qns3a.
+CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NAME /TABLE qnd5a BY qns3a.
+CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=LABEL /TABLE qnd5a BY qns3a.
+CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=BOTH /TABLE qnd5a BY qns3a.
+CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a BY qns3a.
+]])
+AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
+ Custom Tables
+╭────────────────────────────────────────────────────────────────┬────────────╮
+│ │S3a. GENDER:│
+│ ├─────┬──────┤
+│ │ Male│Female│
+│ ├─────┼──────┤
+│ │Count│ Count│
+├────────────────────────────────────────────────────────────────┼─────┼──────┤
+│D5a. What would you say is your primary Cuban │ 13│ 7│
+│ethnic background? Mexican │ 175│ 136│
+│ Spanish │ 20│ 28│
+│ South American │ 21│ 13│
+│ Central American │ 27│ 25│
+│ Puerto Rican, OR │ 37│ 41│
+│ Something else │ 35│ 33│
+│ Multiple - cannot │ 2│ 5│
+│ choose one │ │ │
+╰────────────────────────────────────────────────────────────────┴─────┴──────╯
+
+ Custom Tables
+╭──────────────────────────────────┬────────────╮
+│ │ QNS3A │
+│ ├─────┬──────┤
+│ │ Male│Female│
+│ ├─────┼──────┤
+│ │Count│ Count│
+├──────────────────────────────────┼─────┼──────┤
+│QND5A Cuban │ 13│ 7│
+│ Mexican │ 175│ 136│
+│ Spanish │ 20│ 28│
+│ South American │ 21│ 13│
+│ Central American │ 27│ 25│
+│ Puerto Rican, OR │ 37│ 41│
+│ Something else │ 35│ 33│
+│ Multiple - cannot choose one│ 2│ 5│
+╰──────────────────────────────────┴─────┴──────╯
+
+ Custom Tables
+╭────────────────────────────────────────────────────────────────┬────────────╮
+│ │S3a. GENDER:│
+│ ├─────┬──────┤
+│ │ Male│Female│
+│ ├─────┼──────┤
+│ │Count│ Count│
+├────────────────────────────────────────────────────────────────┼─────┼──────┤
+│D5a. What would you say is your primary Cuban │ 13│ 7│
+│ethnic background? Mexican │ 175│ 136│
+│ Spanish │ 20│ 28│
+│ South American │ 21│ 13│
+│ Central American │ 27│ 25│
+│ Puerto Rican, OR │ 37│ 41│
+│ Something else │ 35│ 33│
+│ Multiple - cannot │ 2│ 5│
+│ choose one │ │ │
+╰────────────────────────────────────────────────────────────────┴─────┴──────╯
+
+ Custom Tables
+╭────────────────────────────────────────────────────────────┬────────────────╮
+│ │ QNS3A S3a. │
+│ │ GENDER: │
+│ ├───────┬────────┤
+│ │ Male │ Female │
+│ ├───────┼────────┤
+│ │ Count │ Count │
+├────────────────────────────────────────────────────────────┼───────┼────────┤
+│QND5A D5a. What would you say is your Cuban │ 13│ 7│
+│primary ethnic background? Mexican │ 175│ 136│
+│ Spanish │ 20│ 28│
+│ South American │ 21│ 13│
+│ Central American │ 27│ 25│
+│ Puerto Rican, OR │ 37│ 41│
+│ Something else │ 35│ 33│
+│ Multiple - cannot │ 2│ 5│
+│ choose one │ │ │
+╰────────────────────────────────────────────────────────────┴───────┴────────╯
+
+ Custom Tables
+╭────────────────────────────┬─────┬──────╮
+│ │ Male│Female│
+│ ├─────┼──────┤
+│ │Count│ Count│
+├────────────────────────────┼─────┼──────┤
+│Cuban │ 13│ 7│
+│Mexican │ 175│ 136│
+│Spanish │ 20│ 28│
+│South American │ 21│ 13│
+│Central American │ 27│ 25│
+│Puerto Rican, OR │ 37│ 41│
+│Something else │ 35│ 33│
+│Multiple - cannot choose one│ 2│ 5│
+╰────────────────────────────┴─────┴──────╯
+])
+AT_CLEANUP
+
+AT_SETUP([CTABLES FORMAT EMPTY])
+AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
+AT_DATA([ctables.sps],
+[[GET 'nhtsa.sav'.
+CTABLES /FORMAT EMPTY=ZERO /TABLE qnd5a BY qnd5.
+CTABLES /FORMAT EMPTY=BLANK /TABLE qnd5a BY qnd5.
+CTABLES /FORMAT EMPTY='n/a' /TABLE qnd5a 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 │
+│ ├───────────────┼───────────────┤
+│ │ Count │ Count │
+├─────────────────────────────────────────────┼───────────────┼───────────────┤
+│D5a. What would you say is Cuban │ 20│ 0│
+│your primary ethnic Mexican │ 311│ 0│
+│background? Spanish │ 48│ 0│
+│ South American │ 34│ 0│
+│ Central American│ 52│ 0│
+│ Puerto Rican, OR│ 78│ 0│
+│ Something else │ 68│ 0│
+│ Multiple - │ 7│ 0│
+│ cannot choose │ │ │
+│ one │ │ │
+╰─────────────────────────────────────────────┴───────────────┴───────────────╯
+
+ Custom Tables
+╭─────────────────────────────────────────────┬───────────────────────────────╮
+│ │ D5. ETHNICITY: Are you of │
+│ │ Hispanic or Latino origin or │
+│ │ descent? │
+│ ├───────────────┬───────────────┤
+│ │ Yes │ No │
+│ ├───────────────┼───────────────┤
+│ │ Count │ Count │
+├─────────────────────────────────────────────┼───────────────┼───────────────┤
+│D5a. What would you say is Cuban │ 20│ │
+│your primary ethnic Mexican │ 311│ │
+│background? Spanish │ 48│ │
+│ South American │ 34│ │
+│ Central American│ 52│ │
+│ Puerto Rican, OR│ 78│ │
+│ Something else │ 68│ │
+│ Multiple - │ 7│ │
+│ cannot choose │ │ │
+│ one │ │ │
+╰─────────────────────────────────────────────┴───────────────┴───────────────╯
+
+ Custom Tables
+╭─────────────────────────────────────────────┬───────────────────────────────╮
+│ │ D5. ETHNICITY: Are you of │
+│ │ Hispanic or Latino origin or │
+│ │ descent? │
+│ ├───────────────┬───────────────┤
+│ │ Yes │ No │
+│ ├───────────────┼───────────────┤
+│ │ Count │ Count │
+├─────────────────────────────────────────────┼───────────────┼───────────────┤
+│D5a. What would you say is Cuban │ 20│n/a │
+│your primary ethnic Mexican │ 311│n/a │
+│background? Spanish │ 48│n/a │
+│ South American │ 34│n/a │
+│ Central American│ 52│n/a │
+│ Puerto Rican, OR│ 78│n/a │
+│ Something else │ 68│n/a │
+│ Multiple - │ 7│n/a │
+│ cannot choose │ │ │
+│ one │ │ │
+╰─────────────────────────────────────────────┴───────────────┴───────────────╯
+])
+AT_CLEANUP
+
+AT_SETUP([CTABLES 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
+
+AT_SETUP([CTABLES HIDESMALLCOUNTS])
+AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
+AT_DATA([ctables.sps],
+[[GET 'nhtsa.sav'.
+CTABLES /TABLE qn38[c][COUNT, COLPCT].
+CTABLES /HIDESMALLCOUNTS /TABLE qn38[c][COUNT, COLPCT].
+CTABLES /HIDESMALLCOUNTS COUNT=10 /TABLE qn38[c][COUNT, COLPCT].
+]])
+AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
+ Custom Tables
+╭──────────────────────────────────────────────────────────────┬─────┬────────╮
+│ │Count│Column %│
+├──────────────────────────────────────────────────────────────┼─────┼────────┤
+│38. How many drinks did you have on that Less than one│ 7│ .5%│
+│occasion? 1 │ 491│ 34.9%│
+│ 2 │ 462│ 32.9%│
+│ 3 │ 229│ 16.3%│
+│ 4 │ 82│ 5.8%│
+│ 5 │ 56│ 4.0%│
+│ 6 │ 32│ 2.3%│
+│ 7 │ 9│ .6%│
+│ 8 │ 8│ .6%│
+│ 9 │ 4│ .3%│
+│ 10 │ 6│ .4%│
+│ 11 │ 2│ .1%│
+│ 12 │ 5│ .4%│
+│ 14 │ 1│ .1%│
+│ 15 │ 1│ .1%│
+│ 18 │ 1│ .1%│
+│ 20 │ 4│ .3%│
+│ 25 │ 1│ .1%│
+│ 30 │ 3│ .2%│
+│ 60 │ 1│ .1%│
+│ 99+ │ 0│ .0%│
+╰──────────────────────────────────────────────────────────────┴─────┴────────╯
+
+ Custom Tables
+╭──────────────────────────────────────────────────────────────┬─────┬────────╮
+│ │Count│Column %│
+├──────────────────────────────────────────────────────────────┼─────┼────────┤
+│38. How many drinks did you have on that Less than one│ 7│ .5%│
+│occasion? 1 │ 491│ 34.9%│
+│ 2 │ 462│ 32.9%│
+│ 3 │ 229│ 16.3%│
+│ 4 │ 82│ 5.8%│
+│ 5 │ 56│ 4.0%│
+│ 6 │ 32│ 2.3%│
+│ 7 │ 9│ .6%│
+│ 8 │ 8│ .6%│
+│ 9 │<5 │ .3%│
+│ 10 │ 6│ .4%│
+│ 11 │<5 │ .1%│
+│ 12 │ 5│ .4%│
+│ 14 │<5 │ .1%│
+│ 15 │<5 │ .1%│
+│ 18 │<5 │ .1%│
+│ 20 │<5 │ .3%│
+│ 25 │<5 │ .1%│
+│ 30 │<5 │ .2%│
+│ 60 │<5 │ .1%│
+│ 99+ │<5 │ .0%│
+╰──────────────────────────────────────────────────────────────┴─────┴────────╯
+
+ Custom Tables
+╭──────────────────────────────────────────────────────────────┬─────┬────────╮
+│ │Count│Column %│
+├──────────────────────────────────────────────────────────────┼─────┼────────┤
+│38. How many drinks did you have on that Less than one│<10 │ .5%│
+│occasion? 1 │ 491│ 34.9%│
+│ 2 │ 462│ 32.9%│
+│ 3 │ 229│ 16.3%│
+│ 4 │ 82│ 5.8%│
+│ 5 │ 56│ 4.0%│
+│ 6 │ 32│ 2.3%│
+│ 7 │<10 │ .6%│
+│ 8 │<10 │ .6%│
+│ 9 │<10 │ .3%│
+│ 10 │<10 │ .4%│
+│ 11 │<10 │ .1%│
+│ 12 │<10 │ .4%│
+│ 14 │<10 │ .1%│
+│ 15 │<10 │ .1%│
+│ 18 │<10 │ .1%│
+│ 20 │<10 │ .3%│
+│ 25 │<10 │ .1%│
+│ 30 │<10 │ .2%│
+│ 60 │<10 │ .1%│
+│ 99+ │<10 │ .0%│
+╰──────────────────────────────────────────────────────────────┴─────┴────────╯
+])
+AT_CLEANUP
+
+AT_SETUP([CTABLES FORMAT MINCOLWIDTH MAXCOLWIDTH])
+AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
+AT_DATA([ctables.sps],
+[[GET 'nhtsa.sav'.
+CTABLES /FORMAT MINCOLWIDTH=1 MAXCOLWIDTH=2 UNITS=INCHES /TABLE BY qns3a.
+]])
+AT_CHECK([pspp ctables.sps -o - -O box=unicode -o pspp.spv], [0], [dnl
+ Custom Tables
+╭────────────╮
+│S3a. GENDER:│
+├─────┬──────┤
+│ Male│Female│
+├─────┼──────┤
+│Count│ Count│
+├─────┼──────┤
+│ 3132│ 3867│
+╰─────┴──────╯
+])
+AT_CHECK([pspp-output get-table-look pspp.spv pspp.stt])
+AT_CHECK([sed 's/ /\n/g' pspp.stt | grep ColumnWidth | sort], [0], [dnl
+maximumColumnWidth="192"
+minimumColumnWidth="96"
+])
+AT_CLEANUP
+
+AT_SETUP([CTABLES special formats])
+AT_KEYWORDS([NEGPAREN NEQUAL PAREN PCTPAREN])
+AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
+AT_DATA([ctables.sps],
+[[GET 'nhtsa.sav'.
+COMPUTE x = qnd3 - 4.
+CTABLES /TABLE x[MINIMUM NEGPAREN8.1, MINIMUM NEQUAL8.1, MINIMUM PAREN8.1, MINIMUM PCTPAREN8.1, MAXIMUM NEGPAREN8.1, MAXIMUM NEQUAL8.1, MAXIMUM PAREN8.1, MAXIMUM PCTPAREN8.1].
+]])
+AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
+ Custom Tables
+╭─┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────╮
+│ │Minimum│Minimum│Minimum│Minimum│Maximum│Maximum│Maximum│Maximum│
+├─┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
+│x│(3.0) │N=-3.0 │(-3.0) │(-3.0%)│8.0 │N=8.0 │(8.0) │(8.0%) │
+╰─┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────╯
+])
+AT_CLEANUP
+
+AT_SETUP([CTABLES TITLES])
+AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
+AT_DATA([ctables.sps],
+[[GET 'nhtsa.sav'.
+CTABLES
+ /VLABELS VARIABLES=qn1 DISPLAY=NONE
+ /TABLE ((qn1[c][COUNT])) BY qns3a[c] > qnd5
+ /TITLES TITLE='How often do you drive?'
+ CAPTION='Generated )TIME on )DATE'
+ CORNER=')TABLE'.
+]])
+AT_CHECK([pspp ctables.sps -O box=unicode | sed 's/..:..:../HH:MM:SS/
+s&../../..&MM/DD/YY&'], [0], [dnl
+ How often do you drive?
+╭───────────────────────────────────┬─────────────────────────────────────────╮
+│ │ S3a. GENDER: │
+│ ├────────────────────┬────────────────────┤
+│ │ Male │ Female │
+│ ├────────────────────┼────────────────────┤
+│ │ D5. ETHNICITY: Are │ D5. ETHNICITY: Are │
+│ │ you of Hispanic or │ you of Hispanic or │
+│ │ Latino origin or │ Latino origin or │
+│( ( 1. How often do you usually │ descent? │ descent? │
+│drive a car or other motor ├─────────┬──────────┼─────────┬──────────┤
+│vehicle?) ) BY S3a. GENDER: > D5. │ Yes │ No │ Yes │ No │
+│ETHNICITY: Are you of Hispanic or ├─────────┼──────────┼─────────┼──────────┤
+│Latino origin or descent? │ Count │ Count │ Count │ Count │
+├───────────────────────────────────┼─────────┼──────────┼─────────┼──────────┤
+│Every day │ 218│ 2066│ 166│ 2175│
+│Several days a week │ 44│ 391│ 45│ 782│
+│Once a week or less │ 16│ 109│ 12│ 223│
+│Only certain times a year │ 15│ 41│ 11│ 61│
+│Never │ 39│ 150│ 56│ 278│
+╰───────────────────────────────────┴─────────┴──────────┴─────────┴──────────╯
+Generated HH:MM:SS on MM/DD/YY
+])
+AT_CLEANUP
+
+AT_SETUP([CTABLES area definitions])
+AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
+AT_DATA([ctables.sps],
+[[GET 'nhtsa.sav'.
+CTABLES
+ /VLABELS VARIABLES=ALL DISPLAY=NAME
+ /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[TABLE.ID, LAYER.ID, SUBTABLE.ID]
+ /SLABELS POSITION=ROW
+ /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[ROW.ID, LAYERROW.ID]
+ /SLABELS POSITION=ROW
+ /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[COL.ID, LAYERCOL.ID]
+ /SLABELS POSITION=ROW.
+]])
+AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=80], [0], [dnl
+ Custom Tables
+Male
+╭─────────────────────────────┬─────────────┬──────╮
+│ │ QND7A │ QN64B│
+│ ├──────┬──────┼───┬──┤
+│ │ Yes │ No │ │ │
+│ ├──────┼──────┤ │ │
+│ │ QN86 │ QN86 │ │ │
+│ ├───┬──┼───┬──┤ │ │
+│ │Yes│No│Yes│No│Yes│No│
+├─────────────────────────────┼───┼──┼───┼──┼───┼──┤
+│QN61 Yes QN57 Yes Table ID │ 1│ 1│ 1│ 1│ 2│ 2│
+│ Layer ID │ 1│ 1│ 1│ 1│ 2│ 2│
+│ Subtable ID│ 1│ 1│ 2│ 2│ 3│ 3│
+│ ╶───────────────┼───┼──┼───┼──┼───┼──┤
+│ No Table ID │ 1│ 1│ 1│ 1│ 2│ 2│
+│ Layer ID │ 1│ 1│ 1│ 1│ 2│ 2│
+│ Subtable ID│ 1│ 1│ 2│ 2│ 3│ 3│
+│ ╶────────────────────────┼───┼──┼───┼──┼───┼──┤
+│ No QN57 Yes Table ID │ 1│ 1│ 1│ 1│ 2│ 2│
+│ Layer ID │ 1│ 1│ 1│ 1│ 2│ 2│
+│ Subtable ID│ 4│ 4│ 5│ 5│ 6│ 6│
+│ ╶───────────────┼───┼──┼───┼──┼───┼──┤
+│ No Table ID │ 1│ 1│ 1│ 1│ 2│ 2│
+│ Layer ID │ 1│ 1│ 1│ 1│ 2│ 2│
+│ Subtable ID│ 4│ 4│ 5│ 5│ 6│ 6│
+╰─────────────────────────────┴───┴──┴───┴──┴───┴──╯
+
+ Custom Tables
+Female
+╭─────────────────────────────┬─────────────┬──────╮
+│ │ QND7A │ QN64B│
+│ ├──────┬──────┼───┬──┤
+│ │ Yes │ No │ │ │
+│ ├──────┼──────┤ │ │
+│ │ QN86 │ QN86 │ │ │
+│ ├───┬──┼───┬──┤ │ │
+│ │Yes│No│Yes│No│Yes│No│
+├─────────────────────────────┼───┼──┼───┼──┼───┼──┤
+│QN61 Yes QN57 Yes Table ID │ 1│ 1│ 1│ 1│ 2│ 2│
+│ Layer ID │ 3│ 3│ 3│ 3│ 4│ 4│
+│ Subtable ID│ 7│ 7│ 8│ 8│ 9│ 9│
+│ ╶───────────────┼───┼──┼───┼──┼───┼──┤
+│ No Table ID │ 1│ 1│ 1│ 1│ 2│ 2│
+│ Layer ID │ 3│ 3│ 3│ 3│ 4│ 4│
+│ Subtable ID│ 7│ 7│ 8│ 8│ 9│ 9│
+│ ╶────────────────────────┼───┼──┼───┼──┼───┼──┤
+│ No QN57 Yes Table ID │ 1│ 1│ 1│ 1│ 2│ 2│
+│ Layer ID │ 3│ 3│ 3│ 3│ 4│ 4│
+│ Subtable ID│ 10│10│ 11│11│ 12│12│
+│ ╶───────────────┼───┼──┼───┼──┼───┼──┤
+│ No Table ID │ 1│ 1│ 1│ 1│ 2│ 2│
+│ Layer ID │ 3│ 3│ 3│ 3│ 4│ 4│
+│ Subtable ID│ 10│10│ 11│11│ 12│12│
+╰─────────────────────────────┴───┴──┴───┴──┴───┴──╯
+
+ Custom Tables
+Male
+╭──────────────────────────────┬─────────────┬──────╮
+│ │ QND7A │ QN64B│
+│ ├──────┬──────┼───┬──┤
+│ │ Yes │ No │ │ │
+│ ├──────┼──────┤ │ │
+│ │ QN86 │ QN86 │ │ │
+│ ├───┬──┼───┬──┤ │ │
+│ │Yes│No│Yes│No│Yes│No│
+├──────────────────────────────┼───┼──┼───┼──┼───┼──┤
+│QN61 Yes QN57 Yes Row ID │ 1│ 1│ 2│ 2│ 3│ 3│
+│ Layer Row ID│ 1│ 1│ 1│ 1│ 2│ 2│
+│ ╶────────────────┼───┼──┼───┼──┼───┼──┤
+│ No Row ID │ 4│ 4│ 5│ 5│ 6│ 6│
+│ Layer Row ID│ 3│ 3│ 3│ 3│ 4│ 4│
+│ ╶─────────────────────────┼───┼──┼───┼──┼───┼──┤
+│ No QN57 Yes Row ID │ 7│ 7│ 8│ 8│ 9│ 9│
+│ Layer Row ID│ 5│ 5│ 5│ 5│ 6│ 6│
+│ ╶────────────────┼───┼──┼───┼──┼───┼──┤
+│ No Row ID │ 10│10│ 11│11│ 12│12│
+│ Layer Row ID│ 7│ 7│ 7│ 7│ 8│ 8│
+╰──────────────────────────────┴───┴──┴───┴──┴───┴──╯
+
+ Custom Tables
+Female
+╭──────────────────────────────┬─────────────┬──────╮
+│ │ QND7A │ QN64B│
+│ ├──────┬──────┼───┬──┤
+│ │ Yes │ No │ │ │
+│ ├──────┼──────┤ │ │
+│ │ QN86 │ QN86 │ │ │
+│ ├───┬──┼───┬──┤ │ │
+│ │Yes│No│Yes│No│Yes│No│
+├──────────────────────────────┼───┼──┼───┼──┼───┼──┤
+│QN61 Yes QN57 Yes Row ID │ 13│13│ 14│14│ 15│15│
+│ Layer Row ID│ 9│ 9│ 9│ 9│ 10│10│
+│ ╶────────────────┼───┼──┼───┼──┼───┼──┤
+│ No Row ID │ 16│16│ 17│17│ 18│18│
+│ Layer Row ID│ 11│11│ 11│11│ 12│12│
+│ ╶─────────────────────────┼───┼──┼───┼──┼───┼──┤
+│ No QN57 Yes Row ID │ 19│19│ 20│20│ 21│21│
+│ Layer Row ID│ 13│13│ 13│13│ 14│14│
+│ ╶────────────────┼───┼──┼───┼──┼───┼──┤
+│ No Row ID │ 22│22│ 23│23│ 24│24│
+│ Layer Row ID│ 15│15│ 15│15│ 16│16│
+╰──────────────────────────────┴───┴──┴───┴──┴───┴──╯
+
+ Custom Tables
+Male
+╭─────────────────────────────────┬─────────────┬──────╮
+│ │ QND7A │ QN64B│
+│ ├──────┬──────┼───┬──┤
+│ │ Yes │ No │ │ │
+│ ├──────┼──────┤ │ │
+│ │ QN86 │ QN86 │ │ │
+│ ├───┬──┼───┬──┤ │ │
+│ │Yes│No│Yes│No│Yes│No│
+├─────────────────────────────────┼───┼──┼───┼──┼───┼──┤
+│QN61 Yes QN57 Yes Column ID │ 1│ 2│ 3│ 4│ 5│ 6│
+│ Layer Column ID│ 1│ 2│ 3│ 4│ 5│ 6│
+│ ╶───────────────────┼───┼──┼───┼──┼───┼──┤
+│ No Column ID │ 1│ 2│ 3│ 4│ 5│ 6│
+│ Layer Column ID│ 1│ 2│ 3│ 4│ 5│ 6│
+│ ╶────────────────────────────┼───┼──┼───┼──┼───┼──┤
+│ No QN57 Yes Column ID │ 7│ 8│ 9│10│ 11│12│
+│ Layer Column ID│ 1│ 2│ 3│ 4│ 5│ 6│
+│ ╶───────────────────┼───┼──┼───┼──┼───┼──┤
+│ No Column ID │ 7│ 8│ 9│10│ 11│12│
+│ Layer Column ID│ 1│ 2│ 3│ 4│ 5│ 6│
+╰─────────────────────────────────┴───┴──┴───┴──┴───┴──╯
+
+ Custom Tables
+Female
+╭─────────────────────────────────┬─────────────┬──────╮
+│ │ QND7A │ QN64B│
+│ ├──────┬──────┼───┬──┤
+│ │ Yes │ No │ │ │
+│ ├──────┼──────┤ │ │
+│ │ QN86 │ QN86 │ │ │
+│ ├───┬──┼───┬──┤ │ │
+│ │Yes│No│Yes│No│Yes│No│
+├─────────────────────────────────┼───┼──┼───┼──┼───┼──┤
+│QN61 Yes QN57 Yes Column ID │ 13│14│ 15│16│ 17│18│
+│ Layer Column ID│ 7│ 8│ 9│10│ 11│12│
+│ ╶───────────────────┼───┼──┼───┼──┼───┼──┤
+│ No Column ID │ 13│14│ 15│16│ 17│18│
+│ Layer Column ID│ 7│ 8│ 9│10│ 11│12│
+│ ╶────────────────────────────┼───┼──┼───┼──┼───┼──┤
+│ No QN57 Yes Column ID │ 19│20│ 21│22│ 23│24│
+│ Layer Column ID│ 7│ 8│ 9│10│ 11│12│
+│ ╶───────────────────┼───┼──┼───┼──┼───┼──┤
+│ No Column ID │ 19│20│ 21│22│ 23│24│
+│ Layer Column ID│ 7│ 8│ 9│10│ 11│12│
+╰─────────────────────────────────┴───┴──┴───┴──┴───┴──╯
+])
+AT_CLEANUP
+
+AT_SETUP([CTABLES summary functions])
+AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
+AT_DATA([ctables.sps],
+[[GET 'nhtsa.sav'.
+CTABLES
+ /TABLE region > qnd5 + qnd6_1 BY qnd7a + agegroup BY qns3a[COUNT, ROWPCT, COLPCT, SUBTABLEPCT]
+ /SLABELS POSITION=ROW.
+]])
+AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [])
+AT_CLEANUP
+