-/*
- Mark missing cases. Return the number of non-missing cases.
- Compute the first two moments.
- */
-static size_t
-mark_missing_cases (const struct casefile *cf, struct variable *v,
- int *is_missing_case, double n_data, struct moments_var *mom)
-{
- struct casereader *r;
- struct ccase c;
- size_t row;
- const union value *val;
- double w = 1.0;
-
- for (r = casefile_get_reader (cf, NULL);
- casereader_read (r, &c); case_destroy (&c))
- {
- row = casereader_cnum (r) - 1;
-
- val = case_data (&c, v);
- if (mom != NULL)
- {
- moments1_add (mom->m, val->f, w);
- }
- cat_value_update (v, val);
- if (var_is_value_missing (v, val, MV_ANY))
- {
- if (!is_missing_case[row])
- {
- /* Now it is missing. */
- n_data--;
- is_missing_case[row] = 1;
- }
- }
- }
- casereader_destroy (r);
-
- return n_data;
-}
-