FACTOR: Don't try to perform analysis if there are no variables.
authorJohn Darrington <john@darrington.wattle.id.au>
Thu, 11 May 2017 12:01:50 +0000 (14:01 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Thu, 11 May 2017 12:01:50 +0000 (14:01 +0200)
src/language/stats/factor.c

index 49bc8a4d67f5334fa4af3737edd99b1d4c368acd..e83a6497b5a76984084bf90f47008b8004e8b641 100644 (file)
@@ -1467,6 +1467,12 @@ cmd_factor (struct lexer *lexer, struct dataset *ds)
   if (factor.n_vars < 2)
     msg (MW, _("Factor analysis on a single variable is not useful."));
 
+  if (factor.n_vars < 1)
+    {
+      msg (ME, _("Factor analysis without variables is not possible."));
+      goto error;
+    }
+
   if (matrix_reader)
     {
       struct idata *id = idata_alloc (factor.n_vars);