From: Ben Pfaff Date: Thu, 4 Aug 2022 23:39:48 +0000 (-0700) Subject: HIDESMALLCOUNTS X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pspp;a=commitdiff_plain;h=0adeecb1efdc424496743623aeef483bf29ee0fb HIDESMALLCOUNTS --- diff --git a/src/language/stats/ctables.c b/src/language/stats/ctables.c index f8c3f89f0d..64c399bcbc 100644 --- a/src/language/stats/ctables.c +++ b/src/language/stats/ctables.c @@ -905,102 +905,9 @@ ctables_function_availability (enum ctables_summary_function f) static bool ctables_summary_function_is_count (enum ctables_summary_function f) { - switch (f) - { - case CTSF_COUNT: - case CTSF_ECOUNT: - case CTSF_ROWPCT_COUNT: - case CTSF_COLPCT_COUNT: - case CTSF_TABLEPCT_COUNT: - case CTSF_SUBTABLEPCT_COUNT: - case CTSF_LAYERPCT_COUNT: - case CTSF_LAYERROWPCT_COUNT: - case CTSF_LAYERCOLPCT_COUNT: - case CTSF_UCOUNT: - case CTSF_UROWPCT_COUNT: - case CTSF_UCOLPCT_COUNT: - case CTSF_UTABLEPCT_COUNT: - case CTSF_USUBTABLEPCT_COUNT: - case CTSF_ULAYERPCT_COUNT: - case CTSF_ULAYERROWPCT_COUNT: - case CTSF_ULAYERCOLPCT_COUNT: - return true; - - case CTSF_ROWPCT_VALIDN: - case CTSF_COLPCT_VALIDN: - case CTSF_TABLEPCT_VALIDN: - case CTSF_SUBTABLEPCT_VALIDN: - case CTSF_LAYERPCT_VALIDN: - case CTSF_LAYERROWPCT_VALIDN: - case CTSF_LAYERCOLPCT_VALIDN: - case CTSF_ROWPCT_TOTALN: - case CTSF_COLPCT_TOTALN: - case CTSF_TABLEPCT_TOTALN: - case CTSF_SUBTABLEPCT_TOTALN: - case CTSF_LAYERPCT_TOTALN: - case CTSF_LAYERROWPCT_TOTALN: - case CTSF_LAYERCOLPCT_TOTALN: - case CTSF_MAXIMUM: - case CTSF_MEAN: - case CTSF_MEDIAN: - case CTSF_MINIMUM: - case CTSF_MISSING: - case CTSF_MODE: - case CTSF_PTILE: - case CTSF_RANGE: - case CTSF_SEMEAN: - case CTSF_STDDEV: - case CTSF_SUM: - case CSTF_TOTALN: - case CTSF_ETOTALN: - case CTSF_VALIDN: - case CTSF_EVALIDN: - case CTSF_VARIANCE: - case CTSF_ROWPCT_SUM: - case CTSF_COLPCT_SUM: - case CTSF_TABLEPCT_SUM: - case CTSF_SUBTABLEPCT_SUM: - case CTSF_LAYERPCT_SUM: - case CTSF_LAYERROWPCT_SUM: - case CTSF_LAYERCOLPCT_SUM: - case CTSF_UROWPCT_VALIDN: - case CTSF_UCOLPCT_VALIDN: - case CTSF_UTABLEPCT_VALIDN: - case CTSF_USUBTABLEPCT_VALIDN: - case CTSF_ULAYERPCT_VALIDN: - case CTSF_ULAYERROWPCT_VALIDN: - case CTSF_ULAYERCOLPCT_VALIDN: - case CTSF_UROWPCT_TOTALN: - case CTSF_UCOLPCT_TOTALN: - case CTSF_UTABLEPCT_TOTALN: - case CTSF_USUBTABLEPCT_TOTALN: - case CTSF_ULAYERPCT_TOTALN: - case CTSF_ULAYERROWPCT_TOTALN: - case CTSF_ULAYERCOLPCT_TOTALN: - case CTSF_UMEAN: - case CTSF_UMEDIAN: - case CTSF_UMISSING: - case CTSF_UMODE: - case CTSF_UPTILE: - case CTSF_USEMEAN: - case CTSF_USTDDEV: - case CTSF_USUM: - case CSTF_UTOTALN: - case CTSF_UVALIDN: - case CTSF_UVARIANCE: - case CTSF_UROWPCT_SUM: - case CTSF_UCOLPCT_SUM: - case CTSF_UTABLEPCT_SUM: - case CTSF_USUBTABLEPCT_SUM: - case CTSF_ULAYERPCT_SUM: - case CTSF_ULAYERROWPCT_SUM: - case CTSF_ULAYERCOLPCT_SUM: - return false; - } - NOT_REACHED (); + return f == CTSF_COUNT || f == CTSF_ECOUNT || f == CTSF_UCOUNT; } - static bool parse_ctables_summary_function (struct lexer *lexer, enum ctables_summary_function *f) diff --git a/tests/language/stats/ctables.at b/tests/language/stats/ctables.at index 652a1a500e..0b85e617e8 100644 --- a/tests/language/stats/ctables.at +++ b/tests/language/stats/ctables.at @@ -17,7 +17,6 @@ dnl * THRU (numeric ranges) dnl * OTHERNM dnl - FORMAT: dnl * MINCOLWIDTH, MAXCOLWIDTH, UNITS. -dnl - HIDESMALLCOUNTS. dnl - Date/time variables and values dnl - Special formats for summary functions: NEGPAREN, NEQUAL, PAREN, PCTPAREN. dnl - TITLES: )DATE, )TIME, )TABLE. @@ -2282,4 +2281,96 @@ AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl │ one │ │ │ ╰─────────────────────────────────────────────┴───────────────┴───────────────╯ ]) -AT_CLEANUP \ No newline at end of file +AT_CLEANUP + +AT_SETUP([CTABLES HIDESMALLCOUNTS]) +AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .]) +AT_DATA([ctables.sps], +[[GET 'nhtsa.sav'. +CTABLES /TABLE qn38[c][COUNT, COLPCT]. +CTABLES /HIDESMALLCOUNTS /TABLE qn38[c][COUNT, COLPCT]. +CTABLES /HIDESMALLCOUNTS COUNT=10 /TABLE qn38[c][COUNT, COLPCT]. +]]) +AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl + Custom Tables +╭──────────────────────────────────────────────────────────────┬─────┬────────╮ +│ │Count│Column %│ +├──────────────────────────────────────────────────────────────┼─────┼────────┤ +│38. How many drinks did you have on that Less than one│ 7│ .5%│ +│occasion? 1 │ 491│ 34.9%│ +│ 2 │ 462│ 32.9%│ +│ 3 │ 229│ 16.3%│ +│ 4 │ 82│ 5.8%│ +│ 5 │ 56│ 4.0%│ +│ 6 │ 32│ 2.3%│ +│ 7 │ 9│ .6%│ +│ 8 │ 8│ .6%│ +│ 9 │ 4│ .3%│ +│ 10 │ 6│ .4%│ +│ 11 │ 2│ .1%│ +│ 12 │ 5│ .4%│ +│ 14 │ 1│ .1%│ +│ 15 │ 1│ .1%│ +│ 18 │ 1│ .1%│ +│ 20 │ 4│ .3%│ +│ 25 │ 1│ .1%│ +│ 30 │ 3│ .2%│ +│ 60 │ 1│ .1%│ +│ 99+ │ 0│ .0%│ +╰──────────────────────────────────────────────────────────────┴─────┴────────╯ + + Custom Tables +╭──────────────────────────────────────────────────────────────┬─────┬────────╮ +│ │Count│Column %│ +├──────────────────────────────────────────────────────────────┼─────┼────────┤ +│38. How many drinks did you have on that Less than one│ 7│ .5%│ +│occasion? 1 │ 491│ 34.9%│ +│ 2 │ 462│ 32.9%│ +│ 3 │ 229│ 16.3%│ +│ 4 │ 82│ 5.8%│ +│ 5 │ 56│ 4.0%│ +│ 6 │ 32│ 2.3%│ +│ 7 │ 9│ .6%│ +│ 8 │ 8│ .6%│ +│ 9 │<5 │ .3%│ +│ 10 │ 6│ .4%│ +│ 11 │<5 │ .1%│ +│ 12 │ 5│ .4%│ +│ 14 │<5 │ .1%│ +│ 15 │<5 │ .1%│ +│ 18 │<5 │ .1%│ +│ 20 │<5 │ .3%│ +│ 25 │<5 │ .1%│ +│ 30 │<5 │ .2%│ +│ 60 │<5 │ .1%│ +│ 99+ │<5 │ .0%│ +╰──────────────────────────────────────────────────────────────┴─────┴────────╯ + + Custom Tables +╭──────────────────────────────────────────────────────────────┬─────┬────────╮ +│ │Count│Column %│ +├──────────────────────────────────────────────────────────────┼─────┼────────┤ +│38. How many drinks did you have on that Less than one│<10 │ .5%│ +│occasion? 1 │ 491│ 34.9%│ +│ 2 │ 462│ 32.9%│ +│ 3 │ 229│ 16.3%│ +│ 4 │ 82│ 5.8%│ +│ 5 │ 56│ 4.0%│ +│ 6 │ 32│ 2.3%│ +│ 7 │<10 │ .6%│ +│ 8 │<10 │ .6%│ +│ 9 │<10 │ .3%│ +│ 10 │<10 │ .4%│ +│ 11 │<10 │ .1%│ +│ 12 │<10 │ .4%│ +│ 14 │<10 │ .1%│ +│ 15 │<10 │ .1%│ +│ 18 │<10 │ .1%│ +│ 20 │<10 │ .3%│ +│ 25 │<10 │ .1%│ +│ 30 │<10 │ .2%│ +│ 60 │<10 │ .1%│ +│ 99+ │<10 │ .0%│ +╰──────────────────────────────────────────────────────────────┴─────┴────────╯ +]) +AT_CLEANUP