case CTSF_LAYERPCT_SUM:
case CTSF_LAYERROWPCT_SUM:
case CTSF_LAYERCOLPCT_SUM:
- moments1_add (s->moments, value->f, weight);
+ if (!var_is_value_missing (var, value))
+ moments1_add (s->moments, value->f, weight);
break;
case CTSF_MEDIAN:
if (new_subtable)
{
n_levels = 0;
- printf ("%s levels:", pivot_axis_type_to_string (a));
for (size_t k = 0; k < nest->n; k++)
{
enum ctables_vlabel vlabel = ct->vlabels[var_get_dict_index (nest->vars[k])];
if (vlabel != CTVL_NONE)
{
- printf (" var(%s)", var_get_name (nest->vars[k]));
levels[n_levels++] = (struct ctables_level) {
.type = CTL_VAR,
.var_idx = k,
if (nest->scale_idx != k
&& (k != nest->n - 1 || t->label_axis[a] == a))
{
- printf (" category(%s)", var_get_name (nest->vars[k]));
levels[n_levels++] = (struct ctables_level) {
.type = CTL_CATEGORY,
.var_idx = k,
if (a == t->slabels_axis && a == t->summary_axis)
{
- printf (" summary");
levels[n_levels++] = (struct ctables_level) {
.type = CTL_SUMMARY,
.var_idx = SIZE_MAX,
};
}
- printf ("\n");
}
size_t n_common = 0;
CTABLES /TABLE=x[c] > y[c] [ROWPCT.COUNT].
]])
AT_CHECK([pspp ctables.sps])
-AT_CLEANUP
\ No newline at end of file
+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