Simple test for TOTALS.
authorBen Pfaff <blp@cs.stanford.edu>
Wed, 19 Jan 2022 01:48:58 +0000 (17:48 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Sat, 2 Apr 2022 01:48:55 +0000 (18:48 -0700)
examples/automake.mk
tests/language/stats/ctables.at

index fd78765c00bc9b86fecfdd025d8f3a572fe190dc..0b8197e977c1dcd025c451a1186546fc84399a77 100644 (file)
@@ -25,6 +25,7 @@ examples_DATA = \
        examples/grid.sps \
        examples/hotel.sav \
        examples/horticulture.sav \
+       examples/nhtsa.sav \
        examples/personnel.sav \
        examples/physiology.sav \
        examples/repairs.sav \
index be67e3e56947697188ec9551e39476811257d1ea..46147b42c064400a5690434cc87dfc39370e1709 100644 (file)
@@ -478,3 +478,57 @@ 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],
+[[GET 'nhtsa.sav'.
+CTABLES /TABLE=qn17
+    /CATEGORIES VARIABLES=qn17 TOTAL=YES LABEL='Number responding'.
+CTABLES /TABLE=region > qn18 [MEAN, COUNT]
+    /CATEGORIES VARIABLES=region TOTAL=YES LABEL='All regions'.
+]])
+AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
+                                  Custom Tables
+╭────────────────────────────────────────────────────────────────────────┬─────╮
+│                                                                        │Count│
+├────────────────────────────────────────────────────────────────────────┼─────┤
+│17. When you drink alcoholic beverages, which ONE of  OR, something else│    2│
+│the following beverages do you drink MOST OFTEN?      Beer              │ 1073│
+│                                                      Light beer        │  620│
+│                                                      Wine              │ 1418│
+│                                                      Wine coolers      │  137│
+│                                                      Hard liquor or    │  888│
+│                                                      mixed drinks      │     │
+│                                                      Flavored malt     │   83│
+│                                                      drinks            │     │
+│                                                      Number responding │ 4221│
+╰────────────────────────────────────────────────────────────────────────┴─────╯
+
+                                  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?                                           │    │     │
+╰───────────────────────────────────────────────────────────────────┴────┴─────╯
+])
+AT_CLEANUP