AT_BANNER([CTABLES])
+dnl TODO:
+dnl
+dnl - Parsing (positive and negative)
+dnl - String variables and values
+dnl - Date/time variables and values
+dnl - Multiple-response sets.
+dnl * MRSETS subcommand.
+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 * Separate summary functions for totals and subtotals.
+dnl - Special formats for summary functions: NEGPAREN, NEQUAL, PAREN, PCTPAREN.
+dnl - Testing details of missing value handling in summaries.
+dnl - test CLABELS ROWLABELS=LAYER.
+dnl - CATEGORIES:
+dnl * Special case for explicit category specifications and multiple dichotomy sets
+dnl * THRU
+dnl * OTHERNM
+dnl * String values
+dnl * Date values
+dnl * Data-dependent sorting.
+dnl - TITLES: )DATE, )TIME, )TABLE.
+dnl - SIGTEST
+dnl - COMPARETEST
+dnl - FORMAT:
+dnl * MINCOLWIDTH, MAXCOLWIDTH, UNITS.
+dnl * EMPTY.
+dnl * MISSING.
+dnl - VLABELS.
+dnl - SMISSING.
+dnl - Test WEIGHT and adjustment weights.
+dnl - Test PCOMPUTE and PPROPERTIES.
+dnl - PCOMPUTE:
+dnl * multi-dimensional
+dnl * MISSING, OTHERNM
+dnl * strings
+dnl - HIDESMALLCOUNTS.
+dnl - Are string ranges a thing?
+
# AT_SETUP([CTABLES parsing])
# AT_DATA([ctables.sps],
# [[DATA LIST LIST NOTABLE /x y z.
])
AT_CLEANUP
+AT_SETUP([CTABLES show or hide empty categories])
+AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
+AT_DATA([ctables.sps],
+[[GET 'nhtsa.sav'.
+IF (qn105ba = 2) qn105ba = 1.
+IF (qns3a = 1) qns3a = 2.
+CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0].
+CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
+ /CATEGORIES VAR=qn105ba EMPTY=EXCLUDE.
+CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
+ /CATEGORIES VAR=qns3a EMPTY=EXCLUDE.
+CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
+ /CATEGORIES VAR=ALL EMPTY=EXCLUDE.
+]])
+AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
+ Custom Tables
+╭──────────────────────────────────────────────────────────────┬───────────────╮
+│ │ S3a. GENDER: │
+│ ├───────┬───────┤
+│ │ Male │ Female│
+│ ├───────┼───────┤
+│ │ Column│ Column│
+│ │ % │ % │
+├──────────────────────────────────────────────────────────────┼───────┼───────┤
+│105b. How likely is it that drivers who have had Almost │ .│ 32%│
+│too much to drink to drive safely will A. Get certain │ │ │
+│stopped by the police? Very likely│ .│ 0%│
+│ Somewhat │ .│ 40%│
+│ likely │ │ │
+│ Somewhat │ .│ 19%│
+│ unlikely │ │ │
+│ Very │ .│ 9%│
+│ unlikely │ │ │
+╰──────────────────────────────────────────────────────────────┴───────┴───────╯
+
+ Custom Tables
+╭──────────────────────────────────────────────────────────────┬───────────────╮
+│ │ S3a. GENDER: │
+│ ├───────┬───────┤
+│ │ Male │ Female│
+│ ├───────┼───────┤
+│ │ Column│ Column│
+│ │ % │ % │
+├──────────────────────────────────────────────────────────────┼───────┼───────┤
+│105b. How likely is it that drivers who have had Almost │ .│ 32%│
+│too much to drink to drive safely will A. Get certain │ │ │
+│stopped by the police? Somewhat │ .│ 40%│
+│ likely │ │ │
+│ Somewhat │ .│ 19%│
+│ unlikely │ │ │
+│ Very │ .│ 9%│
+│ unlikely │ │ │
+╰──────────────────────────────────────────────────────────────┴───────┴───────╯
+
+ Custom Tables
+╭────────────────────────────────────────────────────────────────────┬─────────╮
+│ │ S3a. │
+│ │ GENDER: │
+│ ├─────────┤
+│ │ Female │
+│ ├─────────┤
+│ │ Column %│
+├────────────────────────────────────────────────────────────────────┼─────────┤
+│105b. How likely is it that drivers who have had too Almost │ 32%│
+│much to drink to drive safely will A. Get stopped by certain │ │
+│the police? Very likely │ 0%│
+│ Somewhat │ 40%│
+│ likely │ │
+│ Somewhat │ 19%│
+│ unlikely │ │
+│ Very │ 9%│
+│ unlikely │ │
+╰────────────────────────────────────────────────────────────────────┴─────────╯
+
+ Custom Tables
+╭────────────────────────────────────────────────────────────────────┬─────────╮
+│ │ S3a. │
+│ │ GENDER: │
+│ ├─────────┤
+│ │ Female │
+│ ├─────────┤
+│ │ Column %│
+├────────────────────────────────────────────────────────────────────┼─────────┤
+│105b. How likely is it that drivers who have had too Almost │ 32%│
+│much to drink to drive safely will A. Get stopped by certain │ │
+│the police? Somewhat │ 40%│
+│ likely │ │
+│ Somewhat │ 19%│
+│ unlikely │ │
+│ Very │ 9%│
+│ unlikely │ │
+╰────────────────────────────────────────────────────────────────────┴─────────╯
+])
+AT_CLEANUP
AT_SETUP([CTABLES simple nesting])
AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
[[GET 'nhtsa.sav'.
CTABLES /TABLE=qnd1 > qn1 BY qns3a.
CTABLES /TABLE=qnd1 [MINIMUM, MAXIMUM, MEAN] > qns3a > (qn26 + qn27).
-CTABLES /TABLE=qnsa1 > qn105ba [COLPCT] BY qns1.
+CTABLES /TABLE=qnsa1 > qn105ba [COLPCT] BY qns1
+ /CATEGORIES VAR=qnsa1 EMPTY=EXCLUDE.
CTABLES /TABLE=AgeGroup > qn20 [MEAN F8.1, STDDEV F8.1].
]])
AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
╰─────────────────────────────────────────────────────────┴───────┴───────┴────╯
Custom Tables
-╭──────────────────────────────────┬───────────────────────────────────────────╮
-│ │S1. Including yourself, how many members of│
-│ │ this household are age 16 or older? │
-│ ├──────┬───────┬──────┬──────┬───────┬──────┤
-│ │ │ │ │ │ │ 6 or │
-│ │ 1 │ 2 │ 3 │ 4 │ 5 │ more │
-│ ├──────┼───────┼──────┼──────┼───────┼──────┤
-│ │Column│ Column│Column│Column│ Column│Column│
-│ │ % │ % │ % │ % │ % │ % │
-├──────────────────────────────────┼──────┼───────┼──────┼──────┼───────┼──────┤
-│Sa1. RDD 105b. How Almost │ 9.5%│ 8.2%│ 12.4%│ 9.9%│ 20.0%│ 23.8%│
-│SAMPLE likely is it certain │ │ │ │ │ │ │
-│SOURCE: that drivers Very │ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
-│ who have had likely │ │ │ │ │ │ │
-│ too much to Somewhat│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
-│ drink to likely │ │ │ │ │ │ │
-│ drive safely Somewhat│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│ 9.5%│
-│ will A. Get unlikely│ │ │ │ │ │ │
-│ stopped by Very │ 9.2%│ 9.7%│ 8.2%│ 9.4%│ 7.3%│ 9.5%│
-│ the police? unlikely│ │ │ │ │ │ │
-╰──────────────────────────────────┴──────┴───────┴──────┴──────┴───────┴──────╯
+╭─────────────────────────────┬────────────────────────────────────────────────╮
+│ │S1. Including yourself, how many members of this│
+│ │ household are age 16 or older? │
+│ ├──────┬──────┬──────┬──────┬──────┬──────┬──────┤
+│ │ │ │ │ │ │ │ 6 or │
+│ │ None │ 1 │ 2 │ 3 │ 4 │ 5 │ more │
+│ ├──────┼──────┼──────┼──────┼──────┼──────┼──────┤
+│ │Column│Column│Column│Column│Column│Column│Column│
+│ │ % │ % │ % │ % │ % │ % │ % │
+├─────────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
+│Sa1. RDD 105b. Almost │ .│ 9.5%│ 8.2%│ 12.4%│ 9.9%│ 20.0%│ 23.8%│
+│SAMPLE How certain │ │ │ │ │ │ │ │
+│SOURCE: likely │ │ │ │ │ │ │ │
+│ is it Very │ .│ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
+│ that likely │ │ │ │ │ │ │ │
+│ drivers │ │ │ │ │ │ │ │
+│ who have │ │ │ │ │ │ │ │
+│ had too Somewhat│ .│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
+│ much to likely │ │ │ │ │ │ │ │
+│ drink to │ │ │ │ │ │ │ │
+│ drive │ │ │ │ │ │ │ │
+│ safely Somewhat│ .│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│ 9.5%│
+│ will A. unlikely│ │ │ │ │ │ │ │
+│ Get │ │ │ │ │ │ │ │
+│ stopped Very │ .│ 9.2%│ 9.7%│ 8.2%│ 9.4%│ 7.3%│ 9.5%│
+│ by the unlikely│ │ │ │ │ │ │ │
+│ police? │ │ │ │ │ │ │ │
+╰─────────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
Custom Tables
╭──────────────────────────────────────────────────────────────┬────┬──────────╮
╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
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 │ 9.5%│ 8.2%│ 12.4%│ 9.9%│ 20.0%│ 23.8%│
-│too much to drink to drive safely will A. Get certain │ │ │ │ │ │ │
-│stopped by the police? Very likely│ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
-│ Somewhat │ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
-│ likely │ │ │ │ │ │ │
-│ Subtotal │ 72.8%│ 68.6%│ 75.0%│ 74.0%│ 81.8%│ 81.0%│
-│ Somewhat │ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│ 9.5%│
-│ unlikely │ │ │ │ │ │ │
-│ Very │ 9.2%│ 9.7%│ 8.2%│ 9.4%│ 7.3%│ 9.5%│
-│ unlikely │ │ │ │ │ │ │
-│ Subtotal │ 27.2%│ 31.4%│ 25.0%│ 26.0%│ 18.2%│ 19.0%│
-╰────────────────────────────────────────────────────────────┴─────────┴────────┴─────────┴────────┴─────────┴─────────╯
+╭────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────╮
+│ │ S1. Including yourself, how many members of this household │
+│ │ are age 16 or older? │
+│ ├────────┬────────┬────────┬────────┬───────┬────────┬────────┤
+│ │ │ │ │ │ │ │ 6 or │
+│ │ None │ 1 │ 2 │ 3 │ 4 │ 5 │ more │
+│ ├────────┼────────┼────────┼────────┼───────┼────────┼────────┤
+│ │ │ │ │ │ Column│ │ │
+│ │Column %│Column %│Column %│Column %│ % │Column %│Column %│
+├────────────────────────────────────────────────────────┼────────┼────────┼────────┼────────┼───────┼────────┼────────┤
+│105b. How likely is it that drivers who have Almost │ .│ 9.5%│ 8.2%│ 12.4%│ 9.9%│ 20.0%│ 23.8%│
+│had too much to drink to drive safely will certain │ │ │ │ │ │ │ │
+│A. Get stopped by the police? Very likely│ .│ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
+│ Somewhat │ .│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
+│ likely │ │ │ │ │ │ │ │
+│ Subtotal │ │ 72.8%│ 68.6%│ 75.0%│ 74.0%│ 81.8%│ 81.0%│
+│ Somewhat │ .│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│ 9.5%│
+│ unlikely │ │ │ │ │ │ │ │
+│ Very │ .│ 9.2%│ 9.7%│ 8.2%│ 9.4%│ 7.3%│ 9.5%│
+│ unlikely │ │ │ │ │ │ │ │
+│ Subtotal │ │ 27.2%│ 31.4%│ 25.0%│ 26.0%│ 18.2%│ 19.0%│
+╰────────────────────────────────────────────────────────┴────────┴────────┴────────┴────────┴───────┴────────┴────────╯
Custom Tables
╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
])
AT_CLEANUP
+
+AT_SETUP([CTABLES PCOMPUTE])
+AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
+AT_DATA([ctables.sps],
+[[GET 'nhtsa.sav'.
+CTABLES
+ /PCOMPUTE &x=EXPR([3] + [4])
+ /PCOMPUTE &y=EXPR([4] + [5])
+ /PPROPERTIES &x LABEL='3+4' HIDESOURCECATS=YES
+ /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
+╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
+│ │ 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 │
+├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
+│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 │ │ │ │ │ │ │ │
+╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
+])
+AT_CLEANUP