CTABLES
[pspp] / tests / language / stats / ctables.at
index efb59ca23a6d6521a54afbc8246ae9aa61c882f0..0b6e769af1c4dcf87399d6a40c216376a0ec5846 100644 (file)
@@ -2703,14 +2703,86 @@ Female
 ])
 AT_CLEANUP
 
-AT_SETUP([CTABLES summary functions])
+AT_SETUP([CTABLES categorical 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]
+    /TABLE region BY qnd5a[COUNT, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, TOTAL[COUNT, VALIDN, TOTALN]]
+    /CATEGORIES VARIABLES=qnd5a TOTAL=YES MISSING=INCLUDE
     /SLABELS POSITION=ROW.
 ]])
-AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [])
+AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
+                                                      Custom Tables
+╭─────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────╮
+│                 │                     D5a. What would you say is your primary ethnic background?                     │
+│                 ├─────┬───────┬───────┬──────────┬──────────┬─────────┬──────────┬──────────────┬──────┬───────┬─────┤
+│                 │     │       │       │          │          │         │          │  Multiple -  │      │       │     │
+│                 │     │       │       │   South  │  Central │  Puerto │ Something│ cannot choose│ Don't│       │     │
+│                 │Cuban│Mexican│Spanish│ American │ American │Rican, OR│   else   │      one     │ know │Refused│Total│
+├─────────────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
+│Region NE Count  │    6│      8│      8│        11│         7│       39│        23│             2│     0│      1│  105│
+│          Row %  │ 5.7%│   7.6%│   7.6%│     10.5%│      6.7%│    37.1%│     21.9%│          1.9%│   .0%│   1.0%│     │
+│          Row    │ 5.8%│   7.7%│   7.7%│     10.6%│      6.7%│    37.5%│     22.1%│          1.9%│   .0%│    .0%│     │
+│          Valid N│     │       │       │          │          │         │          │              │      │       │     │
+│          %      │     │       │       │          │          │         │          │              │      │       │     │
+│          Row    │  .4%│    .6%│    .6%│       .8%│       .5%│     2.8%│      1.6%│           .1%│   .0%│    .1%│     │
+│          Total N│     │       │       │          │          │         │          │              │      │       │     │
+│          %      │     │       │       │          │          │         │          │              │      │       │     │
+│          Valid N│     │       │       │          │          │         │          │              │      │       │  104│
+│          Total N│     │       │       │          │          │         │          │              │      │       │ 1409│
+│      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
+│       MW Count  │    3│     24│      1│         4│         5│        9│         6│             0│     0│      1│   53│
+│          Row %  │ 5.7%│  45.3%│   1.9%│      7.5%│      9.4%│    17.0%│     11.3%│           .0%│   .0%│   1.9%│     │
+│          Row    │ 5.8%│  46.2%│   1.9%│      7.7%│      9.6%│    17.3%│     11.5%│           .0%│   .0%│    .0%│     │
+│          Valid N│     │       │       │          │          │         │          │              │      │       │     │
+│          %      │     │       │       │          │          │         │          │              │      │       │     │
+│          Row    │  .2%│   1.5%│    .1%│       .2%│       .3%│      .5%│       .4%│           .0%│   .0%│    .1%│     │
+│          Total N│     │       │       │          │          │         │          │              │      │       │     │
+│          %      │     │       │       │          │          │         │          │              │      │       │     │
+│          Valid N│     │       │       │          │          │         │          │              │      │       │   52│
+│          Total N│     │       │       │          │          │         │          │              │      │       │ 1654│
+│      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
+│       S  Count  │   10│    113│     11│        14│        25│       23│        20│             2│     3│      2│  223│
+│          Row %  │ 4.5%│  50.7%│   4.9%│      6.3%│     11.2%│    10.3%│      9.0%│           .9%│  1.3%│    .9%│     │
+│          Row    │ 4.6%│  51.8%│   5.0%│      6.4%│     11.5%│    10.6%│      9.2%│           .9%│   .0%│    .0%│     │
+│          Valid N│     │       │       │          │          │         │          │              │      │       │     │
+│          %      │     │       │       │          │          │         │          │              │      │       │     │
+│          Row    │  .4%│   4.7%│    .5%│       .6%│      1.0%│     1.0%│       .8%│           .1%│   .1%│    .1%│     │
+│          Total N│     │       │       │          │          │         │          │              │      │       │     │
+│          %      │     │       │       │          │          │         │          │              │      │       │     │
+│          Valid N│     │       │       │          │          │         │          │              │      │       │  218│
+│          Total N│     │       │       │          │          │         │          │              │      │       │ 2390│
+│      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
+│       W  Count  │    1│    166│     28│         5│        15│        7│        19│             3│     0│      1│  245│
+│          Row %  │  .4%│  67.8%│  11.4%│      2.0%│      6.1%│     2.9%│      7.8%│          1.2%│   .0%│    .4%│     │
+│          Row    │  .4%│  68.0%│  11.5%│      2.0%│      6.1%│     2.9%│      7.8%│          1.2%│   .0%│    .0%│     │
+│          Valid N│     │       │       │          │          │         │          │              │      │       │     │
+│          %      │     │       │       │          │          │         │          │              │      │       │     │
+│          Row    │  .1%│  10.7%│   1.8%│       .3%│      1.0%│      .5%│      1.2%│           .2%│   .0%│    .1%│     │
+│          Total N│     │       │       │          │          │         │          │              │      │       │     │
+│          %      │     │       │       │          │          │         │          │              │      │       │     │
+│          Valid N│     │       │       │          │          │         │          │              │      │       │  244│
+│          Total N│     │       │       │          │          │         │          │              │      │       │ 1546│
+╰─────────────────┴─────┴───────┴───────┴──────────┴──────────┴─────────┴──────────┴──────────────┴──────┴───────┴─────╯
+])
+AT_CLEANUP
+
+
+AT_SETUP([CTABLES scale summary functions])
+AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
+AT_DATA([ctables.sps],
+[[GET 'nhtsa.sav'.
+SET TVAR=NAME.
+SPLIT FILE BY REGION.
+FREQUENCIES qn19a /STATISTICS=ALL /FORMAT NOTABLE.
+SPLIT FILE OFF.
+CTABLES
+    /VLABELS VARIABLE=qn19a DISPLAY=NAME /*XXX NONE yields an assertion failure
+    /TABLE region BY qn19a[COUNT, MAXIMUM, MEAN, MINIMUM, MISSING, MODE]
+    /CATEGORIES VARIABLES=qn19a TOTAL=YES MISSING=INCLUDE
+    /SLABELS POSITION=ROW.
+]])
+AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [])
 AT_CLEANUP