Ensure correct behaviour when the state var is missing.
authorJohn Darrington <john@darrington.wattle.id.au>
Fri, 17 Jul 2009 15:11:44 +0000 (23:11 +0800)
committerJohn Darrington <john@darrington.wattle.id.au>
Fri, 17 Jul 2009 15:11:44 +0000 (23:11 +0800)
When the state variable is missing, then the entire
case is skipped.

src/language/stats/roc.c
tests/command/roc.sh

index 0709992ce469ae113814f6996b549fe0d684b7fc..1e8ac4e021a75334cb55a0257f3093e93e487daf 100644 (file)
@@ -49,7 +49,7 @@ struct cmd_roc
   const struct variable **vars;
   const struct dictionary *dict;
 
-  struct variable *state_var ;
+  const struct variable *state_var ;
   union value state_value;
 
   /* Plot the roc curve */
@@ -640,14 +640,21 @@ do_roc (struct cmd_roc *roc, struct casereader *reader, struct dictionary *dict)
   struct subcase up_ordering;
   struct subcase down_ordering;
 
+  struct casewriter *neg_wtr = NULL;
+
   struct casereader *input = casereader_create_filter_missing (reader,
                                                               roc->vars, roc->n_vars,
                                                               roc->exclude,
                                                               NULL,
                                                               NULL);
 
+  input = casereader_create_filter_missing (input,
+                                           &roc->state_var, 1,
+                                           roc->exclude,
+                                           NULL,
+                                           NULL);
 
-  struct casewriter *neg_wtr = autopaging_writer_create (casereader_get_proto (input));
+  neg_wtr = autopaging_writer_create (casereader_get_proto (input));
 
   prepare_cutpoints (roc, rs, input);
 
index 57dad752fa73c705781171f12fd31a0845b07b16..0c24f0c585961f799c6ccd23fdddfd0ab1dd3381 100755 (executable)
@@ -73,6 +73,7 @@ begin data.
 4 2 14 1
 4 3 2  0
 5 4 20 1
+5 4 20 .
 5 5 1  0
 end data.