2-d subtotals work
[pspp] / tests / language / stats / ctables.at
index 46147b42c064400a5690434cc87dfc39370e1709..511ea02d1831a44f822cfa1e2cb5d3981dd29468 100644 (file)
@@ -479,7 +479,6 @@ AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
 ])
 AT_CLEANUP
 
-
 AT_SETUP([CTABLES simple totals])
 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
 AT_DATA([ctables.sps],
@@ -532,3 +531,82 @@ AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
 ╰───────────────────────────────────────────────────────────────────┴────┴─────╯
 ])
 AT_CLEANUP
+
+AT_SETUP([CTABLES subtotals])
+AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
+AT_DATA([ctables.sps],
+[[GET 'nhtsa.sav'.
+CTABLES /TABLE=qn105ba BY qns1
+    /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
+CTABLES /TABLE=qn105ba [COLPCT] BY qns1
+    /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL].
+CTABLES /TABLE=qn105ba BY qns1
+    /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL]
+    /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
+]])
+AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
+                                                      Custom Tables
+╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
+│                                                         │ S1. Including yourself, how many members of this household │
+│                                                         │                    are age 16 or older?                    │
+│                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
+│                                                         │   1   │   2   │ Subtotal│   3   │    4   │   5  │ Subtotal │
+│                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
+│                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
+├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
+│105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     62│      19│    11│        92│
+│had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
+│Get stopped by the police?                    Very likely│    384│    552│      936│    120│      51│    14│       185│
+│                                              Somewhat   │    590│   1249│     1839│    193│      72│    20│       285│
+│                                              likely     │       │       │         │       │        │      │          │
+│                                              Somewhat   │    278│    647│      925│     84│      32│     6│       122│
+│                                              unlikely   │       │       │         │       │        │      │          │
+│                                              Very       │    141│    290│      431│     41│      18│     4│        63│
+│                                              unlikely   │       │       │         │       │        │      │          │
+╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
+
+                                                      Custom Tables
+╭────────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────╮
+│                                                            │     S1. Including yourself, how many members of this    │
+│                                                            │              household are age 16 or older?             │
+│                                                            ├─────────┬────────┬─────────┬────────┬─────────┬─────────┤
+│                                                            │    1    │    2   │    3    │    4   │    5    │6 or more│
+│                                                            ├─────────┼────────┼─────────┼────────┼─────────┼─────────┤
+│                                                            │ Column %│Column %│ Column %│Column %│ Column %│ Column %│
+├────────────────────────────────────────────────────────────┼─────────┼────────┼─────────┼────────┼─────────┼─────────┤
+│105b. How likely is it that drivers who have had Almost     │     4.8%│    4.1%│     6.2%│    4.9%│    10.0%│    11.9%│
+│too much to drink to drive safely will A. Get    certain    │         │        │         │        │         │         │
+│stopped by the police?                           Very likely│    12.5%│    9.2%│    12.0%│   13.3%│    12.7%│    16.7%│
+│                                                 Somewhat   │    19.2%│   20.9%│    19.3%│   18.8%│    18.2%│    11.9%│
+│                                                 likely     │         │        │         │        │         │         │
+│                                                 Subtotal   │    36.4%│   34.3%│    37.5%│   37.0%│    40.9%│    40.5%│
+│                                                 Somewhat   │     9.0%│   10.8%│     8.4%│    8.3%│     5.5%│     4.8%│
+│                                                 unlikely   │         │        │         │        │         │         │
+│                                                 Very       │     4.6%│    4.9%│     4.1%│    4.7%│     3.6%│     4.8%│
+│                                                 unlikely   │         │        │         │        │         │         │
+│                                                 Subtotal   │    13.6%│   15.7%│    12.5%│   13.0%│     9.1%│     9.5%│
+╰────────────────────────────────────────────────────────────┴─────────┴────────┴─────────┴────────┴─────────┴─────────╯
+
+                                                      Custom Tables
+╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
+│                                                         │ S1. Including yourself, how many members of this household │
+│                                                         │                    are age 16 or older?                    │
+│                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
+│                                                         │   1   │   2   │ Subtotal│   3   │    4   │   5  │ Subtotal │
+│                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
+│                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
+├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
+│105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     62│      19│    11│        92│
+│had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
+│Get stopped by the police?                    Very likely│    384│    552│      936│    120│      51│    14│       185│
+│                                              Somewhat   │    590│   1249│     1839│    193│      72│    20│       285│
+│                                              likely     │       │       │         │       │        │      │          │
+│                                              Subtotal   │   1121│   2047│     3168│    375│     142│    45│       562│
+│                                              Somewhat   │    278│    647│      925│     84│      32│     6│       122│
+│                                              unlikely   │       │       │         │       │        │      │          │
+│                                              Very       │    141│    290│      431│     41│      18│     4│        63│
+│                                              unlikely   │       │       │         │       │        │      │          │
+│                                              Subtotal   │    419│    937│     1356│    125│      50│    10│       185│
+╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
+])
+AT_CLEANUP