Handle multiple postcomputes.
[pspp] / tests / language / stats / ctables.at
index 9d58441d881d39761c6451b8b998bf44a0299d0d..d480df3431d1b972ee6e0a84dc5b5458c4faedbd 100644 (file)
@@ -2,30 +2,11 @@ AT_BANNER([CTABLES])
 
 dnl Features not yet implemented:
 dnl
-dnl - Date/time variables and values
 dnl - SPLIT FILE with SEPARATE splits
 dnl - Definition of columns/rows when labels are rotated from one axis to another.
 dnl - Preprocessing to distinguish categorical from scale.
-dnl - )CILEVEL in summary specifications
-dnl - Summary functions:
-dnl   * Unimplemented ones.
-dnl   * U-prefix for unweighted summaries.
-dnl   * .LCL and .UCL suffixes.
-dnl   * .SE suffixes.
-dnl - CATEGORIES:
-dnl   * String values
-dnl   * Date values
-dnl   * Data-dependent sorting.
-dnl - TITLES: )DATE, )TIME, )TABLE.
-dnl - SMISSING (see documentation).
 dnl - PCOMPUTE:
-dnl   * multi-dimensional
-dnl   * MISSING, OTHERNM
-dnl   * strings
-dnl - PPROPERTIES:
-dnl   * )LABEL[N].
-dnl   * summary statistics and formats?
-dnl - Are string ranges a thing?
+dnl   * dates
 dnl
 dnl Features not yet tested:
 dnl - Parsing (positive and negative)
@@ -34,18 +15,38 @@ dnl - Testing details of missing value handling in summaries.
 dnl - test CLABELS ROWLABELS=LAYER.
 dnl - Test VLABELS.
 dnl - Test WEIGHT and adjustment weights.
-dnl - Test PCOMPUTE and PPROPERTIES.
+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   * THRU
+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 - PPROPERTIES:
+dnl   * )LABEL[N].
+dnl - Summary functions:
+dnl   * U-prefix for unweighted summaries.
+dnl   * areaPCT.SUM and UareaPCT.SUM functions.
 dnl
 dnl Not for v1:
 dnl - Multiple response sets
@@ -53,6 +54,11 @@ dnl - MRSETS subcommand.
 dnl - CATEGORIES: Special case for explicit category specifications and multiple dichotomy sets.
 dnl - SIGTEST
 dnl - COMPARETEST
+dnl - Summary functions:
+dnl   * .LCL and .UCL suffixes.
+dnl   * .SE suffixes.
+dnl - CATEGORIES:
+dnl   * Data-dependent sorting.
 dnl
 dnl
 dnl Bug:
@@ -131,17 +137,19 @@ AT_SETUP([CTABLES one scale variable])
 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
 AT_DATA([ctables.sps],
 [[GET 'nhtsa.sav'.
-CTABLES /TABLE qnd1[COUNT, MEAN, STDDEV, MINIMUM, MAXIMUM].
+CTABLES /TABLE qnd1[COUNT, VALIDN, TOTALN, MEAN, STDDEV, MINIMUM, MAXIMUM].
 CTABLES /TABLE BY qnd1.
 CTABLES /TABLE BY BY qnd1.
 ]])
 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
-                            Custom Tables
-╭──────────────────────────┬─────┬────┬─────────────┬───────┬───────╮
-│                          │Count│Mean│Std Deviation│Minimum│Maximum│
-├──────────────────────────┼─────┼────┼─────────────┼───────┼───────┤
-│D1. AGE: What is your age?│ 6930│  48│           19│     16│     86│
-╰──────────────────────────┴─────┴────┴─────────────┴───────┴───────╯
+                                  Custom Tables
+╭──────────────────────┬─────┬───────┬───────┬────┬────────────┬───────┬───────╮
+│                      │     │       │       │    │     Std    │       │       │
+│                      │Count│Valid N│Total N│Mean│  Deviation │Minimum│Maximum│
+├──────────────────────┼─────┼───────┼───────┼────┼────────────┼───────┼───────┤
+│D1. AGE: What is your │ 6999│   6930│   6999│  48│          19│     16│     86│
+│age?                  │     │       │       │    │            │       │       │
+╰──────────────────────┴─────┴───────┴───────┴────┴────────────┴───────┴───────╯
 
         Custom Tables
 ╭──────────────────────────╮
@@ -708,7 +716,8 @@ AT_DATA([ctables.sps],
 [[GET 'nhtsa.sav'.
 CTABLES /TABLE=qn17
     /CATEGORIES VARIABLES=qn17 TOTAL=YES LABEL='Number responding'.
-CTABLES /TABLE=region > qn18 [MEAN, COUNT]
+DESCRIPTIVES qn18/STATISTICS=MEAN.
+CTABLES /TABLE=region > qn18 [MEAN, COUNT, VALIDN, TOTALN]
     /CATEGORIES VARIABLES=region TOTAL=YES LABEL='All regions'.
 ]])
 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
@@ -728,30 +737,41 @@ AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
 │                                                      Number responding │ 4221│
 ╰────────────────────────────────────────────────────────────────────────┴─────╯
 
+                             Descriptive Statistics
+╭────────────────────────────────────────────────────────────────────┬────┬────╮
+│                                                                    │  N │Mean│
+├────────────────────────────────────────────────────────────────────┼────┼────┤
+│18. When you drink ANSWERFROM(QN17R1), about how many               │4218│4.62│
+│ANSWERFROM(QN17R2) do you usually drink per sitting?                │    │    │
+│Valid N (listwise)                                                  │6999│    │
+│Missing N (listwise)                                                │2781│    │
+╰────────────────────────────────────────────────────────────────────┴────┴────╯
+
                                   Custom Tables
-╭───────────────────────────────────────────────────────────────────┬────┬─────╮
-│                                                                   │Mean│Count│
-├───────────────────────────────────────────────────────────────────┼────┼─────┤
-│Region NE       18. When you drink ANSWERFROM(QN17R1), about how   │4.36│  949│
-│                many ANSWERFROM(QN17R2) do you usually drink per   │    │     │
-│                sitting?                                           │    │     │
-│      ╶────────────────────────────────────────────────────────────┼────┼─────┤
-│       MW       18. When you drink ANSWERFROM(QN17R1), about how   │4.67│ 1027│
-│                many ANSWERFROM(QN17R2) do you usually drink per   │    │     │
-│                sitting?                                           │    │     │
-│      ╶────────────────────────────────────────────────────────────┼────┼─────┤
-│       S        18. When you drink ANSWERFROM(QN17R1), about how   │4.71│ 1287│
-│                many ANSWERFROM(QN17R2) do you usually drink per   │    │     │
-│                sitting?                                           │    │     │
-│      ╶────────────────────────────────────────────────────────────┼────┼─────┤
-│       W        18. When you drink ANSWERFROM(QN17R1), about how   │4.69│  955│
-│                many ANSWERFROM(QN17R2) do you usually drink per   │    │     │
-│                sitting?                                           │    │     │
-│      ╶────────────────────────────────────────────────────────────┼────┼─────┤
-│       All      18. When you drink ANSWERFROM(QN17R1), about how   │4.62│ 4218│
-│       regions  many ANSWERFROM(QN17R2) do you usually drink per   │    │     │
-│                sitting?                                           │    │     │
-╰───────────────────────────────────────────────────────────────────┴────┴─────╯
+╭──────────────────────────────────────────────────────┬────┬─────┬──────┬─────╮
+│                                                      │    │     │ Valid│Total│
+│                                                      │Mean│Count│   N  │  N  │
+├──────────────────────────────────────────────────────┼────┼─────┼──────┼─────┤
+│Region NE       18. When you drink ANSWERFROM(QN17R1),│4.36│ 1409│   949│ 1409│
+│                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
+│                you usually drink per sitting?        │    │     │      │     │
+│      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
+│       MW       18. When you drink ANSWERFROM(QN17R1),│4.67│ 1654│  1027│ 1654│
+│                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
+│                you usually drink per sitting?        │    │     │      │     │
+│      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
+│       S        18. When you drink ANSWERFROM(QN17R1),│4.71│ 2390│  1287│ 2390│
+│                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
+│                you usually drink per sitting?        │    │     │      │     │
+│      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
+│       W        18. When you drink ANSWERFROM(QN17R1),│4.69│ 1546│   955│ 1546│
+│                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
+│                you usually drink per sitting?        │    │     │      │     │
+│      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
+│       All      18. When you drink ANSWERFROM(QN17R1),│4.62│ 6999│  4218│ 6999│
+│       regions  about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
+│                you usually drink per sitting?        │    │     │      │     │
+╰──────────────────────────────────────────────────────┴────┴─────┴──────┴─────╯
 ])
 AT_CLEANUP
 
@@ -843,31 +863,31 @@ AT_DATA([ctables.sps],
 CTABLES
     /PCOMPUTE &x=EXPR([3] + [4])
     /PCOMPUTE &y=EXPR([4] + [5])
-    /PPROPERTIES &x LABEL='3+4' HIDESOURCECATS=YES
+    /PPROPERTIES &x LABEL='3+4' HIDESOURCECATS=YES FORMAT=COUNT F8.2
     /PPROPERTIES &y LABEL='4+5'
     /TABLE=qn105ba BY qns1
     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL]
 ]])
 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
                                                       Custom Tables
\95­â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94¬────────────────────────────────────────────────────────────╮
-│                                                         │ S1. Including yourself, how many members of this household │
-│                                                         │                    are age 16 or older?                    │
-│                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
-│                                                         │   1   │   2   │ Subtotal│   5   │   3+4  │  4+5 │ Subtotal │
-│                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
-│                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
\94\9câ\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94¼â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94¼â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94¼─────────┼───────┼────────┼──────┼──────────┤
-│105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     11│      81│    30│        92│
-│had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
-│Get stopped by the police?                    Very likely│    384│    552│      936│     14│     171│    65│       185│
-│                                              Somewhat   │    590│   1249│     1839│     20│     265│    92│       285│
-│                                              likely     │       │       │         │       │        │      │          │
-│                                              Somewhat   │    278│    647│      925│      6│     116│    38│       122│
-│                                              unlikely   │       │       │         │       │        │      │          │
-│                                              Very       │    141│    290│      431│      4│      59│    22│        63│
-│                                              unlikely   │       │       │         │       │        │      │          │
\95°â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94´â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94´â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94´─────────┴───────┴────────┴──────┴──────────╯
\95­â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94¬â\94\80────────────────────────────────────────────────────────────╮
+│                                                        │  S1. Including yourself, how many members of this household │
+│                                                        │                     are age 16 or older?                    │
+│                                                        ├───────┬───────┬──────────┬───────┬────────┬──────┬──────────┤
+│                                                        │   1   │   2   │ Subtotal │   5   │   3+4  │  4+5 │ Subtotal │
+│                                                        ├───────┼───────┼──────────┼───────┼────────┼──────┼──────────┤
+│                                                        │ Count │ Count │   Count  │ Count │  Count │ Count│   Count  │
\94\9câ\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94¼â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94¼â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94¼â\94\80─────────┼───────┼────────┼──────┼──────────┤
+│105b. How likely is it that drivers who have Almost     │    147│    246│       393│     11│   81.00│    30│        92│
+│had too much to drink to drive safely will   certain    │       │       │          │       │        │      │          │
+│A. Get stopped by the police?                Very likely│    384│    552│       936│     14│  171.00│    65│       185│
+│                                             Somewhat   │    590│   1249│      1839│     20│  265.00│    92│       285│
+│                                             likely     │       │       │          │       │        │      │          │
+│                                             Somewhat   │    278│    647│       925│      6│  116.00│    38│       122│
+│                                             unlikely   │       │       │          │       │        │      │          │
+│                                             Very       │    141│    290│       431│      4│   59.00│    22│        63│
+│                                             unlikely   │       │       │          │       │        │      │          │
\95°â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94´â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94´â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94´â\94\80─────────┴───────┴────────┴──────┴──────────╯
 ])
 AT_CLEANUP
 
@@ -922,4 +942,315 @@ AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
 │                        Female│         943│
 ╰──────────────────────────────┴────────────╯
 ])
-AT_CLEANUP
\ No newline at end of file
+AT_CLEANUP
+
+AT_SETUP([CTABLES missing values])
+AT_DATA([ctables.sps],
+[[DATA LIST LIST NOTABLE/x y.
+BEGIN DATA.
+1 1
+1 2
+1 3
+1 4
+1 5
+1 .
+2 1
+2 2
+2 3
+2 4
+2 5
+2 .
+3 1
+3 2
+3 3
+3 4
+3 5
+3 .
+4 1
+4 2
+4 3
+4 4
+4 5
+4 .
+5 1
+5 2
+5 3
+5 4
+5 5
+5 .
+. 1
+. 2
+. 3
+. 4
+. 5
+. .
+END DATA.
+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]]
+    /CATEGORIES VARIABLES=ALL TOTAL=YES.
+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]]
+    /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]]
+    /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]]
+    /CATEGORIES VARIABLES=x [1, 2, 3, 4] TOTAL=YES 
+    /CATEGORIES VARIABLES=y [1, 3, 4, 5] TOTAL=YES 
+    /SLABELS POSITION=ROW.
+]])
+AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
+                               Custom Tables
+╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
+│       │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
+├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
+│x 3.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
+│  4.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
+│  5.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
+│  Total│   18│  100.0%│          100.0%│          100.0%│     18│     36│
+╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
+dnl Note that Column Total N % doesn't add up to 100 because missing
+dnl values are included in the total but not shown as a category and this
+dnl is expected behavior.
+
+                               Custom Tables
+╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
+│       │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
+├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
+│x 1.00 │    6│   20.0%│             .0%│           16.7%│       │       │
+│  2.00 │    6│   20.0%│             .0%│           16.7%│       │       │
+│  3.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
+│  4.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
+│  5.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
+│  Total│   30│  100.0%│          100.0%│          100.0%│     18│     36│
+╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
+dnl Note that Column Total N % doesn't add up to 100 because system-missing
+dnl values are included in the total but not shown as a category and this
+dnl is expected behavior.
+
+                     Custom Tables
+╭────────────────────────┬───────────────────────────╮
+│                        │             y             │
+│                        ├──────┬──────┬──────┬──────┤
+│                        │ 1.00 │ 4.00 │ 5.00 │ Total│
+├────────────────────────┼──────┼──────┼──────┼──────┤
+│x 3.00  Count           │     1│     1│     1│     3│
+│        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
+│        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
+│        Column Total N %│ 16.7%│ 16.7%│ 16.7%│     .│
+│        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
+│        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
+│        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
+│        Valid N         │      │      │      │     3│
+│        Total N         │      │      │      │     6│
+│ ╶──────────────────────┼──────┼──────┼──────┼──────┤
+│  4.00  Count           │     1│     1│     1│     3│
+│        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
+│        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
+│        Column Total N %│ 16.7%│ 16.7%│ 16.7%│     .│
+│        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
+│        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
+│        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
+│        Valid N         │      │      │      │     3│
+│        Total N         │      │      │      │     6│
+│ ╶──────────────────────┼──────┼──────┼──────┼──────┤
+│  5.00  Count           │     1│     1│     1│     3│
+│        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
+│        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
+│        Column Total N %│ 16.7%│ 16.7%│ 16.7%│     .│
+│        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
+│        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
+│        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
+│        Valid N         │      │      │      │     3│
+│        Total N         │      │      │      │     6│
+│ ╶──────────────────────┼──────┼──────┼──────┼──────┤
+│  Total Count           │     3│     3│     3│     9│
+│        Column %        │100.0%│100.0%│100.0%│     .│
+│        Column Valid N %│100.0%│100.0%│100.0%│     .│
+│        Column Total N %│100.0%│100.0%│100.0%│     .│
+│        Row %           │     .│     .│     .│     .│
+│        Row Valid N %   │     .│     .│     .│     .│
+│        Row Total N %   │     .│     .│     .│     .│
+│        Valid N         │     3│     3│     3│     9│
+│        Total N         │     6│     6│     6│    36│
+╰────────────────────────┴──────┴──────┴──────┴──────╯
+
+                            Custom Tables
+╭────────────────────────┬─────────────────────────────────────────╮
+│                        │                    y                    │
+│                        ├──────┬──────┬──────┬──────┬──────┬──────┤
+│                        │ 1.00 │ 2.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
+├────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
+│x 1.00  Count           │     1│     1│     1│     1│     1│     5│
+│        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
+│        Column Valid N %│   .0%│     .│     .│   .0%│   .0%│     .│
+│        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
+│        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
+│        Row Valid N %   │     .│     .│     .│     .│     .│     .│
+│        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
+│        Valid N         │      │      │      │      │      │     0│
+│        Total N         │      │      │      │      │      │     6│
+│ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
+│  2.00  Count           │     1│     1│     1│     1│     1│     5│
+│        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
+│        Column Valid N %│   .0%│     .│     .│   .0%│   .0%│     .│
+│        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
+│        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
+│        Row Valid N %   │     .│     .│     .│     .│     .│     .│
+│        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
+│        Valid N         │      │      │      │      │      │     0│
+│        Total N         │      │      │      │      │      │     6│
+│ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
+│  3.00  Count           │     1│     1│     1│     1│     1│     5│
+│        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
+│        Column Valid N %│ 33.3%│     .│     .│ 33.3%│ 33.3%│     .│
+│        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
+│        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
+│        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
+│        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
+│        Valid N         │      │      │      │      │      │     3│
+│        Total N         │      │      │      │      │      │     6│
+│ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
+│  4.00  Count           │     1│     1│     1│     1│     1│     5│
+│        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
+│        Column Valid N %│ 33.3%│     .│     .│ 33.3%│ 33.3%│     .│
+│        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
+│        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
+│        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
+│        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
+│        Valid N         │      │      │      │      │      │     3│
+│        Total N         │      │      │      │      │      │     6│
+│ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
+│  5.00  Count           │     1│     1│     1│     1│     1│     5│
+│        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
+│        Column Valid N %│ 33.3%│     .│     .│ 33.3%│ 33.3%│     .│
+│        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
+│        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
+│        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
+│        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
+│        Valid N         │      │      │      │      │      │     3│
+│        Total N         │      │      │      │      │      │     6│
+│ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
+│  Total Count           │     5│     5│     5│     5│     5│    25│
+│        Column %        │100.0%│100.0%│100.0%│100.0%│100.0%│     .│
+│        Column Valid N %│100.0%│     .│     .│100.0%│100.0%│     .│
+│        Column Total N %│100.0%│100.0%│100.0%│100.0%│100.0%│     .│
+│        Row %           │     .│     .│     .│     .│     .│     .│
+│        Row Valid N %   │     .│     .│     .│     .│     .│     .│
+│        Row Total N %   │     .│     .│     .│     .│     .│     .│
+│        Valid N         │     3│     0│     0│     3│     3│     9│
+│        Total N         │     6│     6│     6│     6│     6│    36│
+╰────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────╯
+
+                        Custom Tables
+╭────────────────────────┬──────────────────────────────────╮
+│                        │                 y                │
+│                        ├──────┬──────┬──────┬──────┬──────┤
+│                        │ 1.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
+├────────────────────────┼──────┼──────┼──────┼──────┼──────┤
+│x 1.00  Count           │     1│     1│     1│     1│     4│
+│        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
+│        Column Valid N %│   .0%│     .│   .0%│   .0%│     .│
+│        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
+│        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
+│        Row Valid N %   │     .│     .│     .│     .│     .│
+│        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
+│        Valid N         │      │      │      │      │     0│
+│        Total N         │      │      │      │      │     6│
+│ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
+│  2.00  Count           │     1│     1│     1│     1│     4│
+│        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
+│        Column Valid N %│   .0%│     .│   .0%│   .0%│     .│
+│        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
+│        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
+│        Row Valid N %   │     .│     .│     .│     .│     .│
+│        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
+│        Valid N         │      │      │      │      │     0│
+│        Total N         │      │      │      │      │     6│
+│ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
+│  3.00  Count           │     1│     1│     1│     1│     4│
+│        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
+│        Column Valid N %│ 50.0%│     .│ 50.0%│ 50.0%│     .│
+│        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
+│        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
+│        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
+│        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
+│        Valid N         │      │      │      │      │     3│
+│        Total N         │      │      │      │      │     6│
+│ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
+│  4.00  Count           │     1│     1│     1│     1│     4│
+│        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
+│        Column Valid N %│ 50.0%│     .│ 50.0%│ 50.0%│     .│
+│        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
+│        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
+│        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
+│        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
+│        Valid N         │      │      │      │      │     3│
+│        Total N         │      │      │      │      │     6│
+│ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
+│  Total Count           │     4│     4│     4│     4│    16│
+│        Column %        │100.0%│100.0%│100.0%│100.0%│     .│
+│        Column Valid N %│100.0%│     .│100.0%│100.0%│     .│
+│        Column Total N %│100.0%│100.0%│100.0%│100.0%│     .│
+│        Row %           │     .│     .│     .│     .│     .│
+│        Row Valid N %   │     .│     .│     .│     .│     .│
+│        Row Total N %   │     .│     .│     .│     .│     .│
+│        Valid N         │     2│     0│     2│     2│     6│
+│        Total N         │     5│     5│     5│     5│    30│
+╰────────────────────────┴──────┴──────┴──────┴──────┴──────╯
+])
+AT_CLEANUP
+
+AT_SETUP([CTABLES SMISSING=LISTWISE])
+AT_KEYWORDS([SMISSING LISTWISE])
+AT_DATA([ctables.sps],
+[[DATA LIST LIST NOTABLE/x y z.
+BEGIN DATA.
+1  . 40
+1 10 50
+1 20 60
+1  .  .
+1 30  .
+END DATA.
+VARIABLE LEVEL x (NOMINAL).
+
+CTABLES /TABLE (y + z) > x.
+CTABLES /SMISSING LISTWISE /TABLE (y + z) > x.
+
+* The following doesn't come out as listwise because the tables are
+separate, not linked by an > operator.
+CTABLES /SMISSING LISTWISE /TABLE (y > x) + (z > x).
+]])
+AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
+  Custom Tables
+╭────────┬─────╮
+│        │ Mean│
+├────────┼─────┤
+│y x 1.00│20.00│
+├────────┼─────┤
+│z x 1.00│50.00│
+╰────────┴─────╯
+
+  Custom Tables
+╭────────┬─────╮
+│        │ Mean│
+├────────┼─────┤
+│y x 1.00│15.00│
+├────────┼─────┤
+│z x 1.00│55.00│
+╰────────┴─────╯
+
+  Custom Tables
+╭────────┬─────╮
+│        │ Mean│
+├────────┼─────┤
+│y x 1.00│20.00│
+├────────┼─────┤
+│z x 1.00│50.00│
+╰────────┴─────╯
+])
+AT_CLEANUP