X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=tests%2Flanguage%2Fstats%2Fctables.at;h=fd1000b853734325834f237971e4f03b38502543;hb=d8b3292a8c12564dbc67e59f24d626dcfbf2e274;hp=12caa73d3b3c0b57bacb64900f091c950e88224a;hpb=c8c6f68d798526347916230cae33aafb149dd044;p=pspp diff --git a/tests/language/stats/ctables.at b/tests/language/stats/ctables.at index 12caa73d3b..fd1000b853 100644 --- a/tests/language/stats/ctables.at +++ b/tests/language/stats/ctables.at @@ -1,16 +1,12 @@ AT_BANNER([CTABLES]) dnl Features not yet tested: -dnl - Preprocessing to distinguish categorical from scale. -dnl - Testing details of missing value handling in summaries. -dnl - Test WEIGHT and adjustment weights. dnl - Summary functions: dnl * Separate summary functions for totals and subtotals. -dnl * )CILEVEL in summary label specification -dnl - Summary functions: dnl * U-prefix for unweighted summaries. dnl * areaPCT.SUM and UareaPCT.SUM functions. -dnl - SPLIT FILE with SEPARATE splits +dnl * WEIGHT and adjustment weights. +dnl * details of missing value handling in summaries. dnl - Definition of columns/rows when labels are rotated from one axis to another. dnl dnl Not for v1: @@ -22,6 +18,8 @@ dnl - COMPARETEST dnl - Summary functions: dnl * .LCL and .UCL suffixes. dnl * .SE suffixes. +dnl - Summary functions: +dnl * )CILEVEL in summary label specification dnl - CATEGORIES: dnl * Data-dependent sorting. @@ -2053,6 +2051,18 @@ Female ]) AT_CLEANUP +AT_SETUP([CTABLES CLABELS]) +AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .]) +AT_DATA([ctables.sps], +[[GET 'nhtsa.sav'. +CTABLES /TABLE qns3a > (qn26 + qn27 + qn28 + qn29) [COLPCT]. +CTABLES /TABLE qns3a > (qn26 + qn27 + qn28 + qn29) [COLPCT] /CLABELS ROWLABELS=OPPOSITE. +CTABLES /TABLE qns3a > (qn26 + qn27 + qn28 + qn29) [COLPCT] /CLABELS ROWLABELS=LAYER. +]]) +AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode], [0], [dnl +]) +AT_CLEANUP + AT_SETUP([CTABLES missing values]) AT_DATA([ctables.sps], [[DATA LIST LIST NOTABLE/x y. @@ -3028,11 +3038,11 @@ AT_DATA([ctables.sps], [[GET 'nhtsa.sav'. CTABLES /VLABELS VARIABLES=ALL DISPLAY=NAME - /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[TABLE.ID, LAYER.ID, SUBTABLE.ID] + /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[TABLEID, LAYERID, SUBTABLEID] /SLABELS POSITION=ROW - /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[ROW.ID, LAYERROW.ID] + /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[ROWID, LAYERROWID] /SLABELS POSITION=ROW - /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[COL.ID, LAYERCOL.ID] + /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[COLID, LAYERCOLID] /SLABELS POSITION=ROW. ]]) AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=80], [0], [dnl @@ -3255,7 +3265,6 @@ AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl ]) 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], @@ -3535,3 +3544,273 @@ AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl ]) AT_CLEANUP +AT_SETUP([CTABLES with SPLIT FILE]) +AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .]) +AT_DATA([ctables.sps], +[[GET 'nhtsa.sav'. + +SORT CASES BY qns3a. + +CTABLES /TABLE qn105ba. + +* Layered split has no effect on output. +SPLIT FILE BY qns3a. +CTABLES /TABLE qn105ba. + +* Add column variable qns3a to compare against separate splits. +CTABLES /TABLE qn105ba BY qns3a. + +* Separate splits are truly output separately. +SPLIT FILE SEPARATE BY qns3a. +CTABLES /TABLE qn105ba. +]]) +AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl + Custom Tables +╭────────────────────────────────────────────────────────────────────────┬─────╮ +│ │Count│ +├────────────────────────────────────────────────────────────────────────┼─────┤ +│105b. How likely is it that drivers who have had too much Almost │ 700│ +│to drink to drive safely will A. Get stopped by the police? certain │ │ +│ Very likely │ 1502│ +│ Somewhat │ 2763│ +│ likely │ │ +│ Somewhat │ 1307│ +│ unlikely │ │ +│ Very │ 609│ +│ unlikely │ │ +╰────────────────────────────────────────────────────────────────────────┴─────╯ + + Custom Tables +╭────────────────────────────────────────────────────────────────────────┬─────╮ +│ │Count│ +├────────────────────────────────────────────────────────────────────────┼─────┤ +│105b. How likely is it that drivers who have had too much Almost │ 700│ +│to drink to drive safely will A. Get stopped by the police? certain │ │ +│ Very likely │ 1502│ +│ Somewhat │ 2763│ +│ likely │ │ +│ Somewhat │ 1307│ +│ unlikely │ │ +│ Very │ 609│ +│ unlikely │ │ +╰────────────────────────────────────────────────────────────────────────┴─────╯ + + Custom Tables +╭─────────────────────────────────────────────────────────────────┬────────────╮ +│ │S3a. GENDER:│ +│ ├─────┬──────┤ +│ │ Male│Female│ +│ ├─────┼──────┤ +│ │Count│ Count│ +├─────────────────────────────────────────────────────────────────┼─────┼──────┤ +│105b. How likely is it that drivers who have had too Almost │ 297│ 403│ +│much to drink to drive safely will A. Get stopped by certain │ │ │ +│the police? Very likely │ 660│ 842│ +│ Somewhat │ 1174│ 1589│ +│ likely │ │ │ +│ Somewhat │ 640│ 667│ +│ unlikely │ │ │ +│ Very │ 311│ 298│ +│ unlikely │ │ │ +╰─────────────────────────────────────────────────────────────────┴─────┴──────╯ + + Split Values +╭────────────┬─────╮ +│Variable │Value│ +├────────────┼─────┤ +│S3a. GENDER:│Male │ +╰────────────┴─────╯ + + Custom Tables +╭────────────────────────────────────────────────────────────────────────┬─────╮ +│ │Count│ +├────────────────────────────────────────────────────────────────────────┼─────┤ +│105b. How likely is it that drivers who have had too much Almost │ 297│ +│to drink to drive safely will A. Get stopped by the police? certain │ │ +│ Very likely │ 660│ +│ Somewhat │ 1174│ +│ likely │ │ +│ Somewhat │ 640│ +│ unlikely │ │ +│ Very │ 311│ +│ unlikely │ │ +╰────────────────────────────────────────────────────────────────────────┴─────╯ + + Split Values +╭────────────┬──────╮ +│Variable │ Value│ +├────────────┼──────┤ +│S3a. GENDER:│Female│ +╰────────────┴──────╯ + + Custom Tables +╭────────────────────────────────────────────────────────────────────────┬─────╮ +│ │Count│ +├────────────────────────────────────────────────────────────────────────┼─────┤ +│105b. How likely is it that drivers who have had too much Almost │ 403│ +│to drink to drive safely will A. Get stopped by the police? certain │ │ +│ Very likely │ 842│ +│ Somewhat │ 1589│ +│ likely │ │ +│ Somewhat │ 667│ +│ unlikely │ │ +│ Very │ 298│ +│ unlikely │ │ +╰────────────────────────────────────────────────────────────────────────┴─────╯ +]) +AT_CLEANUP + +AT_SETUP([CTABLES variable level inference]) +AT_DATA([data.txt], [dnl +dnl n1 has 10 unique small values -> nominal. +dnl n2 has 23 unique small values -> nominal. +dnl n3 is all missing -> nominal. +dnl s1 has 24 unique small values -> scale. +dnl s2 has one negative value -> scale. +dnl s3 has one non-integer value -> scale. +dnl s4 has no valid values less than 10 -> scale. +dnl s5 has no valid values less than 10,000 -> scale. +1 1 . 1 1 1 10 10001 +2 2 . 2 2 2 11 10002 +3 3 . 3 3 3 12 10003 +4 4 . 4 4 4 13 10004 +5 5 . 5 5 5 14 10005 +6 6 . 6 6 6 15 10006 +7 7 . 7 7 7 16 10007 +8 8 . 8 8 8 17 10008 +9 9 . 9 9 9 18 10009 +10 10 . 10 10 10.5 19 110000 +1 11 . 11 -1 1 11 10001 +2 12 . 12 2 2 12 10002 +3 13 . 13 3 3 13 10003 +4 14 . 14 4 4 14 10004 +5 15 . 15 5 5 15 10005 +6 16 . 16 6 6 16 10006 +7 17 . 17 7 7 17 10007 +8 18 . 18 8 8 18 10008 +9 19 . 19 9 9 19 10009 +1 20 . 20 1 1 20 10001 +2 21 . 21 2 2 21 10002 +3 22 . 22 3 3 22 10003 +4 23 . 23 4 4 23 10004 +5 23 . 24 5 5 24 10005 +6 23 . 24 6 6 25 10006 +]) + +AT_DATA([ctables.sps], [dnl +DATA LIST LIST file='data.txt' NOTABLE /n1 to n3 s1 to s5. + +* Nominal formats (copied from data that will default to scale). +COMPUTE n4=s1. +COMPUTE n5=s1. +FORMATS n4(WKDAY5) n5(MONTH5). + +* Scale formats (copied from data that will default to nominal). +COMPUTE s6=n1. +COMPUTE s7=n1. +COMPUTE s8=n1. +FORMATS s6(DOLLAR6.2) s7(CCA8.2) s8(DATETIME17). + +STRING string(A8). + +DISPLAY DICTIONARY. +CTABLES /TABLE n1 + n2 + n3 + string + s1 + s2 + s3 + s4 + s5. +DISPLAY DICTIONARY. +]) + +AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl + Variables +╭──────┬────────┬──────────────┬─────┬─────┬─────────┬────────────┬────────────╮ +│ │ │ Measurement │ │ │ │ │ │ +│Name │Position│ Level │ Role│Width│Alignment│Print Format│Write Format│ +├──────┼────────┼──────────────┼─────┼─────┼─────────┼────────────┼────────────┤ +│n1 │ 1│Unknown │Input│ 8│Right │F8.2 │F8.2 │ +│n2 │ 2│Unknown │Input│ 8│Right │F8.2 │F8.2 │ +│n3 │ 3│Unknown │Input│ 8│Right │F8.2 │F8.2 │ +│s1 │ 4│Unknown │Input│ 8│Right │F8.2 │F8.2 │ +│s2 │ 5│Unknown │Input│ 8│Right │F8.2 │F8.2 │ +│s3 │ 6│Unknown │Input│ 8│Right │F8.2 │F8.2 │ +│s4 │ 7│Unknown │Input│ 8│Right │F8.2 │F8.2 │ +│s5 │ 8│Unknown │Input│ 8│Right │F8.2 │F8.2 │ +│n4 │ 9│Unknown │Input│ 8│Right │WKDAY5 │WKDAY5 │ +│n5 │ 10│Unknown │Input│ 8│Right │MONTH5 │MONTH5 │ +│s6 │ 11│Unknown │Input│ 8│Right │DOLLAR6.2 │DOLLAR6.2 │ +│s7 │ 12│Unknown │Input│ 8│Right │CCA8.2 │CCA8.2 │ +│s8 │ 13│Unknown │Input│ 8│Right │DATETIME17.0│DATETIME17.0│ +│string│ 14│Nominal │Input│ 8│Left │A8 │A8 │ +╰──────┴────────┴──────────────┴─────┴─────┴─────────┴────────────┴────────────╯ + + Custom Tables +╭────────────┬─────┬────────╮ +│ │Count│ Mean │ +├────────────┼─────┼────────┤ +│n1 1.00 │ 3│ │ +│ 2.00 │ 3│ │ +│ 3.00 │ 3│ │ +│ 4.00 │ 3│ │ +│ 5.00 │ 3│ │ +│ 6.00 │ 3│ │ +│ 7.00 │ 2│ │ +│ 8.00 │ 2│ │ +│ 9.00 │ 2│ │ +│ 10.00│ 1│ │ +├────────────┼─────┼────────┤ +│n2 1.00 │ 1│ │ +│ 2.00 │ 1│ │ +│ 3.00 │ 1│ │ +│ 4.00 │ 1│ │ +│ 5.00 │ 1│ │ +│ 6.00 │ 1│ │ +│ 7.00 │ 1│ │ +│ 8.00 │ 1│ │ +│ 9.00 │ 1│ │ +│ 10.00│ 1│ │ +│ 11.00│ 1│ │ +│ 12.00│ 1│ │ +│ 13.00│ 1│ │ +│ 14.00│ 1│ │ +│ 15.00│ 1│ │ +│ 16.00│ 1│ │ +│ 17.00│ 1│ │ +│ 18.00│ 1│ │ +│ 19.00│ 1│ │ +│ 20.00│ 1│ │ +│ 21.00│ 1│ │ +│ 22.00│ 1│ │ +│ 23.00│ 3│ │ +├────────────┼─────┼────────┤ +│string │ 25│ │ +├────────────┼─────┼────────┤ +│s1 │ │ 12.96│ +├────────────┼─────┼────────┤ +│s2 │ │ 4.76│ +├────────────┼─────┼────────┤ +│s3 │ │ 4.86│ +├────────────┼─────┼────────┤ +│s4 │ │ 16.60│ +├────────────┼─────┼────────┤ +│s5 │ │14004.44│ +╰────────────┴─────┴────────╯ + + Variables +╭──────┬────────┬──────────────┬─────┬─────┬─────────┬────────────┬────────────╮ +│ │ │ Measurement │ │ │ │ │ │ +│Name │Position│ Level │ Role│Width│Alignment│Print Format│Write Format│ +├──────┼────────┼──────────────┼─────┼─────┼─────────┼────────────┼────────────┤ +│n1 │ 1│Nominal │Input│ 8│Right │F8.2 │F8.2 │ +│n2 │ 2│Nominal │Input│ 8│Right │F8.2 │F8.2 │ +│n3 │ 3│Nominal │Input│ 8│Right │F8.2 │F8.2 │ +│s1 │ 4│Scale │Input│ 8│Right │F8.2 │F8.2 │ +│s2 │ 5│Scale │Input│ 8│Right │F8.2 │F8.2 │ +│s3 │ 6│Scale │Input│ 8│Right │F8.2 │F8.2 │ +│s4 │ 7│Scale │Input│ 8│Right │F8.2 │F8.2 │ +│s5 │ 8│Scale │Input│ 8│Right │F8.2 │F8.2 │ +│n4 │ 9│Nominal │Input│ 8│Right │WKDAY5 │WKDAY5 │ +│n5 │ 10│Nominal │Input│ 8│Right │MONTH5 │MONTH5 │ +│s6 │ 11│Scale │Input│ 8│Right │DOLLAR6.2 │DOLLAR6.2 │ +│s7 │ 12│Scale │Input│ 8│Right │CCA8.2 │CCA8.2 │ +│s8 │ 13│Scale │Input│ 8│Right │DATETIME17.0│DATETIME17.0│ +│string│ 14│Nominal │Input│ 8│Left │A8 │A8 │ +╰──────┴────────┴──────────────┴─────┴─────┴─────────┴────────────┴────────────╯ +]) +AT_CLEANUP