524 |
/* Create the target variable in the aggregate |
/* Create the target variable in the aggregate |
525 |
dictionary. */ |
dictionary. */ |
526 |
{ |
{ |
527 |
|
static const struct fmt_spec f8_2 = {FMT_F, 8, 2}; |
528 |
struct variable *destvar; |
struct variable *destvar; |
529 |
|
|
530 |
v->function = func_index; |
v->function = func_index; |
546 |
{ |
{ |
547 |
destvar = dict_create_var (agr->dict, dest[i], 0); |
destvar = dict_create_var (agr->dict, dest[i], 0); |
548 |
|
|
549 |
if ((func_index == N |
if ((func_index == N || func_index == NMISS) |
|
|| func_index == N_NO_VARS |
|
|
|| func_index == NMISS) |
|
550 |
&& dict_get_weight (default_dict) != NULL) |
&& dict_get_weight (default_dict) != NULL) |
551 |
{ |
destvar->print = destvar->write = f8_2; |
|
static const struct fmt_spec f8_2 = {FMT_F, 8, 2}; |
|
|
|
|
|
destvar->print = destvar->write = f8_2; |
|
|
} |
|
552 |
else |
else |
553 |
destvar->print = destvar->write = function->format; |
destvar->print = destvar->write = function->format; |
554 |
} |
} |
558 |
} else { |
} else { |
559 |
v->src = NULL; |
v->src = NULL; |
560 |
destvar = dict_create_var (agr->dict, dest[i], 0); |
destvar = dict_create_var (agr->dict, dest[i], 0); |
561 |
|
if (func_index == N_NO_VARS |
562 |
|
&& dict_get_weight (default_dict) != NULL) |
563 |
|
destvar->print = destvar->write = f8_2; |
564 |
|
else |
565 |
|
destvar->print = destvar->write = function->format; |
566 |
} |
} |
567 |
|
|
568 |
if (!destvar) |
if (!destvar) |
834 |
{ |
{ |
835 |
case SUM: |
case SUM: |
836 |
iter->dbl[0] += v->f * weight; |
iter->dbl[0] += v->f * weight; |
837 |
|
iter->int1 = 1; |
838 |
break; |
break; |
839 |
case MEAN: |
case MEAN: |
840 |
iter->dbl[0] += v->f * weight; |
iter->dbl[0] += v->f * weight; |
1007 |
switch (i->function) |
switch (i->function) |
1008 |
{ |
{ |
1009 |
case SUM: |
case SUM: |
1010 |
v->f = i->dbl[0]; |
v->f = i->int1 ? i->dbl[0] : SYSMIS; |
1011 |
break; |
break; |
1012 |
case MEAN: |
case MEAN: |
1013 |
v->f = i->dbl[1] != 0.0 ? i->dbl[0] / i->dbl[1] : SYSMIS; |
v->f = i->dbl[1] != 0.0 ? i->dbl[0] / i->dbl[1] : SYSMIS; |