/* PSPP - computes sample statistics.
Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc.
- Written by Ben Pfaff <blp@gnu.org>.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
static int cells[8]; /* Cells requested. */
/* WRITE. */
-static int write; /* One of WR_* that specifies the WRITE style. */
+static int write_style; /* One of WR_* that specifies the WRITE style. */
/* Command parsing info. */
static struct cmd_crosstabs cmd;
+ cmd.a_write[CRS_WR_CELLS] == 0))
cmd.a_write[CRS_WR_CELLS] = 1;
if (cmd.a_write[CRS_WR_CELLS])
- write = CRS_WR_CELLS;
+ write_style = CRS_WR_CELLS;
else if (cmd.a_write[CRS_WR_ALL])
- write = CRS_WR_ALL;
+ write_style = CRS_WR_ALL;
else
- write = CRS_WR_NONE;
+ write_style = CRS_WR_NONE;
ok = procedure_with_splits (ds, precalc,
mode == GENERAL ? calc_general : calc_integer,
{
bool bad_warn = true;
+ /* Missing values to exclude. */
+ enum mv_class exclude = (cmd.miss == CRS_TABLE ? MV_ANY
+ : cmd.miss == CRS_INCLUDE ? MV_SYSTEM
+ : MV_NEVER);
+
/* Case weight. */
double weight = dict_get_case_weight (dataset_dict (ds), c, &bad_warn);
for (j = 0; j < x->nvar; j++)
{
const union value *v = case_data (c, x->vars[j]);
- if ((cmd.miss == CRS_TABLE && var_is_value_missing (x->vars[j], v))
- || (cmd.miss == CRS_INCLUDE
- && var_is_value_system_missing (x->vars[j], v)))
+ if (var_is_value_missing (x->vars[j], v, exclude))
{
x->missing += weight;
goto next_crosstab;
/* Note that the first test also rules out SYSMIS. */
if ((value < vr->min || value >= vr->max)
- || (cmd.miss == CRS_TABLE && var_is_num_user_missing (v, value)))
+ || (cmd.miss == CRS_TABLE
+ && var_is_num_missing (v, value, MV_USER)))
{
x->missing += weight;
goto next_crosstab;
int r;
for (r = 0; r < n_rows; r++)
- if (var_is_num_user_missing (x->vars[ROW_VAR], rows[r].f))
+ if (var_is_num_missing (x->vars[ROW_VAR], rows[r].f, MV_USER))
{
int c;
int c;
for (c = 0; c < n_cols; c++)
- if (var_is_num_user_missing (x->vars[COL_VAR], cols[c].f))
+ if (var_is_num_missing (x->vars[COL_VAR], cols[c].f, MV_USER))
{
int r;
s.string = tab_alloc (table, print->w);
format_short (s.string, print, v);
s.length = strlen (s.string);
- if (cmd.miss == CRS_REPORT && var_is_num_user_missing (var, v->f))
+ if (cmd.miss == CRS_REPORT && var_is_num_missing (var, v->f, MV_USER))
s.string[s.length++] = 'M';
while (s.length && *s.string == ' ')
{
bool mark_missing = false;
double expected_value = row_tot[r] * col_tot[c] / W;
if (cmd.miss == CRS_REPORT
- && (var_is_num_user_missing (x->vars[COL_VAR], cols[c].f)
- || var_is_num_user_missing (x->vars[ROW_VAR], rows[r].f)))
+ && (var_is_num_missing (x->vars[COL_VAR], cols[c].f, MV_USER)
+ || var_is_num_missing (x->vars[ROW_VAR], rows[r].f,
+ MV_USER)))
mark_missing = true;
for (i = 0; i < num_cells; i++)
{
bool mark_missing = false;
if (cmd.miss == CRS_REPORT
- && var_is_num_user_missing (x->vars[ROW_VAR], rows[r].f))
+ && var_is_num_missing (x->vars[ROW_VAR], rows[r].f, MV_USER))
mark_missing = true;
for (i = 0; i < num_cells; i++)
int i;
if (cmd.miss == CRS_REPORT && c < n_cols
- && var_is_num_user_missing (x->vars[COL_VAR], cols[c].f))
+ && var_is_num_missing (x->vars[COL_VAR], cols[c].f, MV_USER))
mark_missing = true;
for (i = 0; i < num_cells; i++)