X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=tests%2Flanguage%2Fstats%2Fctables.at;fp=tests%2Flanguage%2Fstats%2Fctables.at;h=e19007e65e17d3a6b7c0620c6b2abb0d2f0890fa;hb=4e8bfea364b7a1d2d496e14dfefc9dfeefff8d11;hp=0000000000000000000000000000000000000000;hpb=b81922824d04dfc85e777827c3f978450dc62594;p=pspp diff --git a/tests/language/stats/ctables.at b/tests/language/stats/ctables.at new file mode 100644 index 0000000000..e19007e65e --- /dev/null +++ b/tests/language/stats/ctables.at @@ -0,0 +1,862 @@ +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? +dnl +dnl Bug: +dnl CTABLES /TABLE=qnd1 [MEAN, MEDIAN] BY qns3a. +dnl produces a bad median: +dnl Custom Tables +dnl +--------------------------+-----------------------+ +dnl | | S3a. GENDER: | +dnl | +-----------+-----------+ +dnl | | Male | Female | +dnl | +----+------+----+------+ +dnl | |Mean|Median|Mean|Median| +dnl +--------------------------+----+------+----+------+ +dnl |D1. AGE: What is your age?| 46| 999| 50| 999| +dnl +--------------------------+----+------+----+------+ + + + +# AT_SETUP([CTABLES parsing]) +# AT_DATA([ctables.sps], +# [[DATA LIST LIST NOTABLE /x y z. +# CTABLES /TABLE=(x + y) > z. +# CTABLES /TABLE=(x[c] + y[c]) > z. +# CTABLES /TABLE=(x + y) > z[c]. +# CTABLES /TABLE=x BY y BY z. +# CTABLES /TABLE=x[c] [ROWPCT.COUNT] > y[c]. +# CTABLES /TABLE=x[c] > y[c] [ROWPCT.COUNT]. +# ]]) +# AT_CHECK([pspp ctables.sps]) +# AT_CLEANUP + +AT_SETUP([CTABLES one categorical variable]) +AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .]) +AT_DATA([ctables.sps], +[[GET 'nhtsa.sav'. +CTABLES /TABLE qn1. +CTABLES /TABLE BY qn1. +CTABLES /TABLE BY BY qn1. +]]) +AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl + Custom Tables +╭────────────────────────────────────────────────────────────────────────┬─────╮ +│ │Count│ +├────────────────────────────────────────────────────────────────────────┼─────┤ +│ 1. How often do you usually drive a car or other Every day │ 4667│ +│motor vehicle? Several days a week │ 1274│ +│ Once a week or less │ 361│ +│ Only certain times a │ 130│ +│ year │ │ +│ Never │ 540│ +╰────────────────────────────────────────────────────────────────────────┴─────╯ + + Custom Tables +╭──────────────────────────────────────────────────────────────────────────────╮ +│ 1. How often do you usually drive a car or other motor vehicle? │ +├─────────┬──────────────────┬──────────────────┬────────────────────────┬─────┤ +│ │ Several days a │ Once a week or │ Only certain times a │ │ +│Every day│ week │ less │ year │Never│ +├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤ +│ Count │ Count │ Count │ Count │Count│ +├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤ +│ 4667│ 1274│ 361│ 130│ 540│ +╰─────────┴──────────────────┴──────────────────┴────────────────────────┴─────╯ + +Custom Tables +Every day +╭─────╮ +│Count│ +├─────┤ +│ 4667│ +╰─────╯ +]) +AT_CLEANUP + +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 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 +╭──────────────────────────╮ +│D1. AGE: What is your age?│ +├──────────────────────────┤ +│ Mean │ +├──────────────────────────┤ +│ 48│ +╰──────────────────────────╯ + +Custom Tables +D1. AGE: What is your age? +╭────╮ +│Mean│ +├────┤ +│ 48│ +╰────╯ +]) +AT_CLEANUP + +AT_SETUP([CTABLES simple stacking]) +AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .]) +AT_DATA([ctables.sps], +[[GET 'nhtsa.sav'. +CTABLES /TABLE qn105ba + qn105bb + qn105bc + qn105bd BY qns3a [COLPCT PCT8.0]. +]]) +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 │ 10%│ 11%│ +│too much to drink to drive safely will A. Get certain │ │ │ +│stopped by the police? Very likely │ 21%│ 22%│ +│ Somewhat │ 38%│ 42%│ +│ likely │ │ │ +│ Somewhat │ 21%│ 18%│ +│ unlikely │ │ │ +│ Very │ 10%│ 8%│ +│ unlikely │ │ │ +├───────────────────────────────────────────────────────────────┼──────┼───────┤ +│105b. How likely is it that drivers who have had Almost │ 14%│ 18%│ +│too much to drink to drive safely will B. Have an certain │ │ │ +│accident? Very likely │ 36%│ 45%│ +│ Somewhat │ 39%│ 32%│ +│ likely │ │ │ +│ Somewhat │ 9%│ 4%│ +│ unlikely │ │ │ +│ Very │ 3%│ 2%│ +│ unlikely │ │ │ +├───────────────────────────────────────────────────────────────┼──────┼───────┤ +│105b. How likely is it that drivers who have had Almost │ 18%│ 16%│ +│too much to drink to drive safely will C. Be certain │ │ │ +│convicted for drunk driving? Very likely │ 32%│ 28%│ +│ Somewhat │ 27%│ 32%│ +│ likely │ │ │ +│ Somewhat │ 15%│ 15%│ +│ unlikely │ │ │ +│ Very │ 9%│ 9%│ +│ unlikely │ │ │ +├───────────────────────────────────────────────────────────────┼──────┼───────┤ +│105b. How likely is it that drivers who have had Almost │ 16%│ 16%│ +│too much to drink to drive safely will D. Be certain │ │ │ +│arrested for drunk driving? Very likely │ 26%│ 27%│ +│ Somewhat │ 32%│ 35%│ +│ likely │ │ │ +│ Somewhat │ 17%│ 15%│ +│ unlikely │ │ │ +│ Very │ 9%│ 7%│ +│ unlikely │ │ │ +╰───────────────────────────────────────────────────────────────┴──────┴───────╯ +]) +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 .]) +AT_DATA([ctables.sps], +[[GET 'nhtsa.sav'. +CTABLES /TABLE (qn105ba + qn105bb + qn105bc + qn105bd) > qns3a [COUNT, TABLEPCT PCT8.0] + /CATEGORIES VARIABLES=qns3a TOTAL=YES. +CTABLES /TABLE qns3a > (qn105ba + qn105bb + qn105bc + qn105bd) [TABLEPCT PCT8.0] + /CATEGORIES VARIABLES=qns3a TOTAL=YES + /CLABELS ROW=OPPOSITE. +]]) +AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl + Custom Tables +╭─────────────────────────────────────────────────────────────────┬─────┬──────╮ +│ │ │ Table│ +│ │Count│ % │ +├─────────────────────────────────────────────────────────────────┼─────┼──────┤ +│105b. How likely is it that drivers Almost S3a. Male │ 297│ 4%│ +│who have had too much to drink to certain GENDER: Female│ 403│ 6%│ +│drive safely will A. Get stopped by Total │ 700│ 10%│ +│the police? ╶──────────────────────────┼─────┼──────┤ +│ Very S3a. Male │ 660│ 10%│ +│ likely GENDER: Female│ 842│ 12%│ +│ Total │ 1502│ 22%│ +│ ╶──────────────────────────┼─────┼──────┤ +│ Somewhat S3a. Male │ 1174│ 17%│ +│ likely GENDER: Female│ 1589│ 23%│ +│ Total │ 2763│ 40%│ +│ ╶──────────────────────────┼─────┼──────┤ +│ Somewhat S3a. Male │ 640│ 9%│ +│ unlikely GENDER: Female│ 667│ 10%│ +│ Total │ 1307│ 19%│ +│ ╶──────────────────────────┼─────┼──────┤ +│ Very S3a. Male │ 311│ 5%│ +│ unlikely GENDER: Female│ 298│ 4%│ +│ Total │ 609│ 9%│ +├─────────────────────────────────────────────────────────────────┼─────┼──────┤ +│105b. How likely is it that drivers Almost S3a. Male │ 429│ 6%│ +│who have had too much to drink to certain GENDER: Female│ 671│ 10%│ +│drive safely will B. Have an accident? Total │ 1100│ 16%│ +│ ╶──────────────────────────┼─────┼──────┤ +│ Very S3a. Male │ 1104│ 16%│ +│ likely GENDER: Female│ 1715│ 25%│ +│ Total │ 2819│ 41%│ +│ ╶──────────────────────────┼─────┼──────┤ +│ Somewhat S3a. Male │ 1203│ 17%│ +│ likely GENDER: Female│ 1214│ 18%│ +│ Total │ 2417│ 35%│ +│ ╶──────────────────────────┼─────┼──────┤ +│ Somewhat S3a. Male │ 262│ 4%│ +│ unlikely GENDER: Female│ 168│ 2%│ +│ Total │ 430│ 6%│ +│ ╶──────────────────────────┼─────┼──────┤ +│ Very S3a. Male │ 81│ 1%│ +│ unlikely GENDER: Female│ 59│ 1%│ +│ Total │ 140│ 2%│ +├─────────────────────────────────────────────────────────────────┼─────┼──────┤ +│105b. How likely is it that drivers Almost S3a. Male │ 539│ 8%│ +│who have had too much to drink to certain GENDER: Female│ 610│ 9%│ +│drive safely will C. Be convicted for Total │ 1149│ 17%│ +│drunk driving? ╶──────────────────────────┼─────┼──────┤ +│ Very S3a. Male │ 988│ 14%│ +│ likely GENDER: Female│ 1049│ 15%│ +│ Total │ 2037│ 30%│ +│ ╶──────────────────────────┼─────┼──────┤ +│ Somewhat S3a. Male │ 822│ 12%│ +│ likely GENDER: Female│ 1210│ 18%│ +│ Total │ 2032│ 30%│ +│ ╶──────────────────────────┼─────┼──────┤ +│ Somewhat S3a. Male │ 446│ 7%│ +│ unlikely GENDER: Female│ 548│ 8%│ +│ Total │ 994│ 15%│ +│ ╶──────────────────────────┼─────┼──────┤ +│ Very S3a. Male │ 268│ 4%│ +│ unlikely GENDER: Female│ 354│ 5%│ +│ Total │ 622│ 9%│ +├─────────────────────────────────────────────────────────────────┼─────┼──────┤ +│105b. How likely is it that drivers Almost S3a. Male │ 498│ 7%│ +│who have had too much to drink to certain GENDER: Female│ 603│ 9%│ +│drive safely will D. Be arrested for Total │ 1101│ 16%│ +│drunk driving? ╶──────────────────────────┼─────┼──────┤ +│ Very S3a. Male │ 805│ 12%│ +│ likely GENDER: Female│ 1029│ 15%│ +│ Total │ 1834│ 27%│ +│ ╶──────────────────────────┼─────┼──────┤ +│ Somewhat S3a. Male │ 975│ 14%│ +│ likely GENDER: Female│ 1332│ 19%│ +│ Total │ 2307│ 34%│ +│ ╶──────────────────────────┼─────┼──────┤ +│ Somewhat S3a. Male │ 535│ 8%│ +│ unlikely GENDER: Female│ 560│ 8%│ +│ Total │ 1095│ 16%│ +│ ╶──────────────────────────┼─────┼──────┤ +│ Very S3a. Male │ 270│ 4%│ +│ unlikely GENDER: Female│ 279│ 4%│ +│ Total │ 549│ 8%│ +╰─────────────────────────────────────────────────────────────────┴─────┴──────╯ + + Custom Tables +╭─────────────────────────────────┬────────┬──────┬─────────┬─────────┬────────╮ +│ │ Almost │ Very │ Somewhat│ Somewhat│ Very │ +│ │ certain│likely│ likely │ unlikely│unlikely│ +│ ├────────┼──────┼─────────┼─────────┼────────┤ +│ │ │ Table│ │ │ │ +│ │ Table %│ % │ Table % │ Table % │ Table %│ +├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤ +│S3a. Male 105b. How likely │ 4%│ 10%│ 17%│ 9%│ 5%│ +│GENDER: is it that drivers│ │ │ │ │ │ +│ who have had too │ │ │ │ │ │ +│ much to drink to │ │ │ │ │ │ +│ drive safely will │ │ │ │ │ │ +│ A. Get stopped by │ │ │ │ │ │ +│ the police? │ │ │ │ │ │ +│ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤ +│ Female 105b. How likely │ 6%│ 12%│ 23%│ 10%│ 4%│ +│ is it that drivers│ │ │ │ │ │ +│ who have had too │ │ │ │ │ │ +│ much to drink to │ │ │ │ │ │ +│ drive safely will │ │ │ │ │ │ +│ A. Get stopped by │ │ │ │ │ │ +│ the police? │ │ │ │ │ │ +│ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤ +│ Total 105b. How likely │ 10%│ 22%│ 40%│ 19%│ 9%│ +│ is it that drivers│ │ │ │ │ │ +│ who have had too │ │ │ │ │ │ +│ much to drink to │ │ │ │ │ │ +│ drive safely will │ │ │ │ │ │ +│ A. Get stopped by │ │ │ │ │ │ +│ the police? │ │ │ │ │ │ +├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤ +│S3a. Male 105b. How likely │ 6%│ 16%│ 17%│ 4%│ 1%│ +│GENDER: is it that drivers│ │ │ │ │ │ +│ who have had too │ │ │ │ │ │ +│ much to drink to │ │ │ │ │ │ +│ drive safely will │ │ │ │ │ │ +│ B. Have an │ │ │ │ │ │ +│ accident? │ │ │ │ │ │ +│ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤ +│ Female 105b. How likely │ 10%│ 25%│ 18%│ 2%│ 1%│ +│ is it that drivers│ │ │ │ │ │ +│ who have had too │ │ │ │ │ │ +│ much to drink to │ │ │ │ │ │ +│ drive safely will │ │ │ │ │ │ +│ B. Have an │ │ │ │ │ │ +│ accident? │ │ │ │ │ │ +│ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤ +│ Total 105b. How likely │ 16%│ 41%│ 35%│ 6%│ 2%│ +│ is it that drivers│ │ │ │ │ │ +│ who have had too │ │ │ │ │ │ +│ much to drink to │ │ │ │ │ │ +│ drive safely will │ │ │ │ │ │ +│ B. Have an │ │ │ │ │ │ +│ accident? │ │ │ │ │ │ +├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤ +│S3a. Male 105b. How likely │ 8%│ 14%│ 12%│ 7%│ 4%│ +│GENDER: is it that drivers│ │ │ │ │ │ +│ who have had too │ │ │ │ │ │ +│ much to drink to │ │ │ │ │ │ +│ drive safely will │ │ │ │ │ │ +│ C. Be convicted │ │ │ │ │ │ +│ for drunk driving?│ │ │ │ │ │ +│ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤ +│ Female 105b. How likely │ 9%│ 15%│ 18%│ 8%│ 5%│ +│ is it that drivers│ │ │ │ │ │ +│ who have had too │ │ │ │ │ │ +│ much to drink to │ │ │ │ │ │ +│ drive safely will │ │ │ │ │ │ +│ C. Be convicted │ │ │ │ │ │ +│ for drunk driving?│ │ │ │ │ │ +│ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤ +│ Total 105b. How likely │ 17%│ 30%│ 30%│ 15%│ 9%│ +│ is it that drivers│ │ │ │ │ │ +│ who have had too │ │ │ │ │ │ +│ much to drink to │ │ │ │ │ │ +│ drive safely will │ │ │ │ │ │ +│ C. Be convicted │ │ │ │ │ │ +│ for drunk driving?│ │ │ │ │ │ +├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤ +│S3a. Male 105b. How likely │ 7%│ 12%│ 14%│ 8%│ 4%│ +│GENDER: is it that drivers│ │ │ │ │ │ +│ who have had too │ │ │ │ │ │ +│ much to drink to │ │ │ │ │ │ +│ drive safely will │ │ │ │ │ │ +│ D. Be arrested for│ │ │ │ │ │ +│ drunk driving? │ │ │ │ │ │ +│ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤ +│ Female 105b. How likely │ 9%│ 15%│ 19%│ 8%│ 4%│ +│ is it that drivers│ │ │ │ │ │ +│ who have had too │ │ │ │ │ │ +│ much to drink to │ │ │ │ │ │ +│ drive safely will │ │ │ │ │ │ +│ D. Be arrested for│ │ │ │ │ │ +│ drunk driving? │ │ │ │ │ │ +│ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤ +│ Total 105b. How likely │ 16%│ 27%│ 34%│ 16%│ 8%│ +│ is it that drivers│ │ │ │ │ │ +│ who have had too │ │ │ │ │ │ +│ much to drink to │ │ │ │ │ │ +│ drive safely will │ │ │ │ │ │ +│ D. Be arrested for│ │ │ │ │ │ +│ drunk driving? │ │ │ │ │ │ +╰─────────────────────────────────┴────────┴──────┴─────────┴─────────┴────────╯ +]) +AT_CLEANUP + +AT_SETUP([CTABLES nesting and scale variables]) +AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .]) +AT_DATA([ctables.sps], +[[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 + /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 +╭─────────────────────────────────────────────────────────────────┬────────────╮ +│ │S3a. GENDER:│ +│ ├─────┬──────┤ +│ │ Male│Female│ +│ ├─────┼──────┤ +│ │ Mean│ Mean │ +├─────────────────────────────────────────────────────────────────┼─────┼──────┤ +│D1. AGE: What 1. How often do you usually drive Every day │ 46│ 46│ +│is your age? a car or other motor vehicle? Several days a │ 51│ 59│ +│ week │ │ │ +│ Once a week or │ 44│ 54│ +│ less │ │ │ +│ Only certain │ 34│ 41│ +│ times a year │ │ │ +│ Never │ 39│ 55│ +╰─────────────────────────────────────────────────────────────────┴─────┴──────╯ + + Custom Tables +╭─────────────────────────────────────────────────────────┬───────┬───────┬────╮ +│ │Minimum│Maximum│Mean│ +├─────────────────────────────────────────────────────────┼───────┼───────┼────┤ +│D1. AGE: S3a. Male 26. During the last 12 Yes│ 16│ 86│ 42│ +│What is GENDER: months, has there been a │ │ │ │ +│your time when you felt you │ │ │ │ +│age? should cut down on your No │ 16│ 86│ 46│ +│ drinking? │ │ │ │ +│ ╶───────────────────────────────────────┼───────┼───────┼────┤ +│ Female 26. During the last 12 Yes│ 16│ 86│ 43│ +│ months, has there been a │ │ │ │ +│ time when you felt you │ │ │ │ +│ should cut down on your No │ 16│ 86│ 48│ +│ drinking? │ │ │ │ +├─────────────────────────────────────────────────────────┼───────┼───────┼────┤ +│D1. AGE: S3a. Male 27. During the last 12 Yes│ 16│ 86│ 38│ +│What is GENDER: months, has there been a │ │ │ │ +│your time when people criticized No │ 16│ 86│ 46│ +│age? your drinking? │ │ │ │ +│ ╶───────────────────────────────────────┼───────┼───────┼────┤ +│ Female 27. During the last 12 Yes│ 17│ 69│ 37│ +│ months, has there been a │ │ │ │ +│ time when people criticized No │ 16│ 86│ 48│ +│ your drinking? │ │ │ │ +╰─────────────────────────────────────────────────────────┴───────┴───────┴────╯ + + Custom Tables +╭─────────────────────────────┬────────────────────────────────────────────────╮ +│ │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 +╭──────────────────────────────────────────────────────────────┬────┬──────────╮ +│ │ │ Std │ +│ │Mean│ Deviation│ +├──────────────────────────────────────────────────────────────┼────┼──────────┤ +│Age 16 to 25 20. On how many of the thirty days in this │ 5.2│ 6.0│ +│group typical month did you have one or more │ │ │ +│ alcoholic beverages to drink? │ │ │ +│ ╶───────────────────────────────────────────────────────┼────┼──────────┤ +│ 26 to 35 20. On how many of the thirty days in this │ 4.7│ 5.9│ +│ typical month did you have one or more │ │ │ +│ alcoholic beverages to drink? │ │ │ +│ ╶───────────────────────────────────────────────────────┼────┼──────────┤ +│ 36 to 45 20. On how many of the thirty days in this │ 5.5│ 6.8│ +│ typical month did you have one or more │ │ │ +│ alcoholic beverages to drink? │ │ │ +│ ╶───────────────────────────────────────────────────────┼────┼──────────┤ +│ 46 to 55 20. On how many of the thirty days in this │ 5.8│ 7.7│ +│ typical month did you have one or more │ │ │ +│ alcoholic beverages to drink? │ │ │ +│ ╶───────────────────────────────────────────────────────┼────┼──────────┤ +│ 56 to 65 20. On how many of the thirty days in this │ 6.3│ 8.2│ +│ typical month did you have one or more │ │ │ +│ alcoholic beverages to drink? │ │ │ +│ ╶───────────────────────────────────────────────────────┼────┼──────────┤ +│ 66 or 20. On how many of the thirty days in this │ 7.1│ 9.2│ +│ older typical month did you have one or more │ │ │ +│ alcoholic beverages to drink? │ │ │ +╰──────────────────────────────────────────────────────────────┴────┴──────────╯ +]) +AT_CLEANUP + + +AT_SETUP([CTABLES SLABELS]) +AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .]) +AT_DATA([ctables.sps], +[[GET 'nhtsa.sav'. +CTABLES /TABLE qn1 [COUNT COLPCT]. +CTABLES /TABLE qn1 [COUNT COLPCT] + /SLABELS POSITION=ROW. +CTABLES /TABLE qn1 [COUNT COLPCT] + /SLABELS POSITION=ROW VISIBLE=NO. +]]) +AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl + Custom Tables +╭────────────────────────────────────────────────────────────────┬─────┬───────╮ +│ │ │ Column│ +│ │Count│ % │ +├────────────────────────────────────────────────────────────────┼─────┼───────┤ +│ 1. How often do you usually drive a car or Every day │ 4667│ 66.9%│ +│other motor vehicle? Several days a week│ 1274│ 18.3%│ +│ Once a week or less│ 361│ 5.2%│ +│ Only certain times │ 130│ 1.9%│ +│ a year │ │ │ +│ Never │ 540│ 7.7%│ +╰────────────────────────────────────────────────────────────────┴─────┴───────╯ + + Custom Tables +╭────────────────────────────────────────────────────────────────────────┬─────╮ +│ 1. How often do you usually drive a car or Every day Count │ 4667│ +│other motor vehicle? Column │66.9%│ +│ % │ │ +│ ╶───────────────────────────┼─────┤ +│ Several days a week Count │ 1274│ +│ Column │18.3%│ +│ % │ │ +│ ╶───────────────────────────┼─────┤ +│ Once a week or less Count │ 361│ +│ Column │ 5.2%│ +│ % │ │ +│ ╶───────────────────────────┼─────┤ +│ Only certain times Count │ 130│ +│ a year Column │ 1.9%│ +│ % │ │ +│ ╶───────────────────────────┼─────┤ +│ Never Count │ 540│ +│ Column │ 7.7%│ +│ % │ │ +╰────────────────────────────────────────────────────────────────────────┴─────╯ + + Custom Tables +╭────────────────────────────────────────────────────────────────────────┬─────╮ +│ 1. How often do you usually drive a car or other Every day │ 4667│ +│motor vehicle? │66.9%│ +│ Several days a week │ 1274│ +│ │18.3%│ +│ Once a week or less │ 361│ +│ │ 5.2%│ +│ Only certain times a │ 130│ +│ year │ 1.9%│ +│ Never │ 540│ +│ │ 7.7%│ +╰────────────────────────────────────────────────────────────────────────┴─────╯ +]) +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 + +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? │ +│ ├────────┬────────┬────────┬────────┬───────┬────────┬────────┤ +│ │ │ │ │ │ │ │ 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 +╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮ +│ │ 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 + +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