+Sat Mar 19 23:06:02 2005 Ben Pfaff <blp@gnu.org>
+
+ * aggregate.c: (parse_aggregate_functions) Fix N_NO_VARS format.
+ (accumulate_aggregate_info) Set int1 to 1 for SUM.
+ (dump_aggregate_info) Only make SUM non-missing if there was at
+ least one variate.
+
Sat Mar 19 14:48:19 2005 Ben Pfaff <blp@gnu.org>
* aggregate.c: (dump_aggregate_info) Properly test whether the
/* Create the target variable in the aggregate
dictionary. */
{
+ static const struct fmt_spec f8_2 = {FMT_F, 8, 2};
struct variable *destvar;
v->function = func_index;
{
destvar = dict_create_var (agr->dict, dest[i], 0);
- if ((func_index == N
- || func_index == N_NO_VARS
- || func_index == NMISS)
+ if ((func_index == N || func_index == NMISS)
&& dict_get_weight (default_dict) != NULL)
- {
- static const struct fmt_spec f8_2 = {FMT_F, 8, 2};
-
- destvar->print = destvar->write = f8_2;
- }
+ destvar->print = destvar->write = f8_2;
else
destvar->print = destvar->write = function->format;
}
} else {
v->src = NULL;
destvar = dict_create_var (agr->dict, dest[i], 0);
+ if (func_index == N_NO_VARS
+ && dict_get_weight (default_dict) != NULL)
+ destvar->print = destvar->write = f8_2;
+ else
+ destvar->print = destvar->write = function->format;
}
if (!destvar)
{
case SUM:
iter->dbl[0] += v->f * weight;
+ iter->int1 = 1;
break;
case MEAN:
iter->dbl[0] += v->f * weight;
switch (i->function)
{
case SUM:
- v->f = i->dbl[0];
+ v->f = i->int1 ? i->dbl[0] : SYSMIS;
break;
case MEAN:
v->f = i->dbl[1] != 0.0 ? i->dbl[0] / i->dbl[1] : SYSMIS;