gsl_matrix *cm;
struct per_var_ws *pvw = &ws.vws[v];
const struct categoricals *cats = covariance_get_categoricals (pvw->cov);
- categoricals_done (cats);
+ const bool ok = categoricals_done (cats);
+
+ if ( ! ok)
+ {
+ msg (MW,
+ _("Dependent variable %s has no non-missing values. No analysis for this variable will be done."),
+ var_get_name (cmd->vars[v]));
+ continue;
+ }
cm = covariance_calculate_unnormalized (pvw->cov);
{
const struct categoricals *cats = covariance_get_categoricals (ws.vws[v].cov);
+ if ( ! categoricals_is_complete (cats))
+ {
+ continue;
+ }
+
if (categoricals_n_total (cats) > ws.actual_number_of_groups)
ws.actual_number_of_groups = categoricals_n_total (cats);
}
{
int v;
for (v = 0 ; v < cmd->n_vars; ++v)
- show_comparisons (cmd, ws, v);
+ {
+ const struct categoricals *cats = covariance_get_categoricals (ws->vws[v].cov);
+
+ if ( categoricals_is_complete (cats))
+ show_comparisons (cmd, ws, v);
+ }
}
}
tab_double (t, 9, row + count, 0, dd->maximum, fmt);
}
+ if (categoricals_is_complete (cats))
{
double T;
double n, mean, variance;
tab_double (t, 7, row + count, 0,
mean + T * std_error, NULL);
+
/* Min and Max */
tab_double (t, 8, row + count, 0, ws->dd_total[v]->minimum, fmt);
tab_double (t, 9, row + count, 0, ws->dd_total[v]->maximum, fmt);
size_t
categoricals_n_total (const struct categoricals *cat)
{
- assert (cat->reverse_variable_map_long);
+ if (!categoricals_is_complete (cat))
+ return 0;
return cat->n_cats_total;
}
return cat->df_sum;
}
+bool
+categoricals_is_complete (const struct categoricals *cat)
+{
+ return (NULL != cat->reverse_variable_map_short);
+}
+
+
/* This function must be called *before* any call to categoricals_get_*_by subscript and
*after* all calls to categoricals_update */
-void
+bool
categoricals_done (const struct categoricals *cat_)
{
/* Implementation Note: Whilst this function is O(n) in cat->n_cats_total, in most
struct variable_node *vn = lookup_variable (&cat->varmap, var, hash_pointer (var, 0));
+ if (hmap_count (&vn->valmap) == 0)
+ return false;
+
cat->iap[i].df_prod[v] = df * (hmap_count (&vn->valmap) - 1);
df = cat->iap[i].df_prod[v];
}
}
}
+
+ return true;
}
size_t categoricals_get_n_variables (const struct categoricals *cat);
+bool categoricals_is_complete (const struct categoricals *cat);
+
+
/*
Must be called (once) before any call to the *_by_subscript or *_by_category
- functions, but AFTER any calls to categoricals_update
+ functions, but AFTER any calls to categoricals_update.
+ If this function returns false, then no calls to _by_subscript or *_by_category
+ are allowed.
*/
-void categoricals_done (const struct categoricals *cat);
+bool categoricals_done (const struct categoricals *cat);
/*
AT_CHECK([pspp -O format=csv crash.sps], [0], [ignore])
-AT_CLEANUP
\ No newline at end of file
+AT_CLEANUP
+
+
+
+AT_SETUP([ONEWAY crash on missing dependent variable])
+AT_DATA([crash2.sps],[dnl
+data list notable list /dv1 * dv2 * y * .
+begin data.
+2 . 2
+1 . 2
+1 . 1
+2 . 4
+3 . 4
+4 . 4
+5 . 4
+end data.
+
+ONEWAY
+ /VARIABLES= dv1 dv2 BY y
+ /STATISTICS = DESCRIPTIVES
+ /POSTHOC = BONFERRONI LSD SCHEFFE SIDAK TUKEY
+ /MISSING = ANALYSIS
+ .
+])
+
+AT_CHECK([pspp -O format=csv crash2.sps], [0], [ignore])
+
+AT_CLEANUP