work on DELETE VARS
[pspp] / src / data / dataset.c
index aa196f2850d84b5df9bf776302a0db62221bc837..ded7c7ab02196e9d6193440b3c13bc0635d93ea0 100644 (file)
@@ -347,6 +347,19 @@ dataset_steal_source (struct dataset *ds)
   return reader;
 }
 
+bool
+dataset_delete_vars (struct dataset *ds, struct variable **vars, size_t n)
+{
+  dict_delete_vars (ds->dict, vars, n);
+
+  if (ds->source)
+    {
+      struct case_map *map = case_map_to_compact_dict (ds->d, 0);
+      ds->source = case_map_create_input_translator (map, ds->source);
+    }
+  dict_compact_values (ds->dict);
+}
+
 /* Returns a number unique to DS.  It can be used to distinguish one dataset
    from any other within a given program run, even datasets that do not exist
    at the same time. */