@menu
* ADD VALUE LABELS:: Add value labels to variables.
+* DELETE VARIABLES:: Delete variables.
* DISPLAY:: Display variable names & descriptions.
* DISPLAY VECTORS:: Display a list of vectors.
* FORMATS:: Set print and write formats.
* WRITE FORMATS:: Set variable write formats.
@end menu
-@node ADD VALUE LABELS, DISPLAY, Variable Attributes, Variable Attributes
+@node ADD VALUE LABELS, DELETE VARIABLES, Variable Attributes, Variable Attributes
@section ADD VALUE LABELS
@vindex ADD VALUE LABELS
LABELS} (@pxref{VALUE LABELS}), but it does not clear value
labels from the variables before adding the ones specified.
-@node DISPLAY, DISPLAY VECTORS, ADD VALUE LABELS, Variable Attributes
+@node DELETE VARIABLES, DISPLAY, ADD VALUE LABELS, Variable Attributes
+@section DELETE VARIABLES
+@vindex DELETE VARIABLES
+
+@display
+DELETE VARIABLES var_list.
+@end display
+
+@cmd{DELETE VARIABLES} deletes the specified variables from the
+dictionary. It may not be used to delete all variables from the
+dictionary; use @cmd{NEW FILE} to do that (@pxref{NEW FILE}).
+
+@cmd{DELETE VARIABLES} should not used after defining transformations
+and before executing a procedure. If it is used in such a context, it
+causes the data to be read. If it is used while @cmd{TEMPORARY} is in
+effect, it causes the temporary transformations to become permanent.
+
+@node DISPLAY, DISPLAY VECTORS, DELETE VARIABLES, Variable Attributes
@section DISPLAY
@vindex DISPLAY
+Wed Dec 13 21:02:51 2006 Ben Pfaff <blp@gnu.org>
+
+ * command.def: Add DELETE VARS.
+
Sat Dec 16 22:15:55 2006 Ben Pfaff <blp@gnu.org>
Make it possible to pull cases from the active file with a
DEF_CMD (S_DATA, 0, "CORRELATIONS", cmd_correlations)
DEF_CMD (S_DATA, 0, "COUNT", cmd_count)
DEF_CMD (S_DATA, 0, "CROSSTABS", cmd_crosstabs)
+DEF_CMD (S_DATA, 0, "DELETE VARIABLES", cmd_delete_variables)
DEF_CMD (S_DATA, 0, "DESCRIPTIVES", cmd_descriptives)
DEF_CMD (S_DATA, 0, "EXAMINE", cmd_examine)
DEF_CMD (S_DATA, 0, "EXECUTE", cmd_execute)
+Wed Dec 13 20:59:54 2006 Ben Pfaff <blp@gnu.org>
+
+ * automake.mk: Add delete-variables.c
+
+ * delete-variables.c (cmd_delete_variables): New function, in new
+ file.
+
Sun Dec 10 13:55:58 2006 Ben Pfaff <blp@gnu.org>
* sys-file-info.c (cmd_sysfile_info): Report floating-point format
language_dictionary_sources = \
src/language/dictionary/apply-dictionary.c \
+ src/language/dictionary/delete-variables.c \
src/language/dictionary/formats.c \
src/language/dictionary/missing-values.c \
src/language/dictionary/modify-variables.c \
--- /dev/null
+/* PSPP - computes sample statistics.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+ Written by Ben Pfaff <blp@gnu.org>.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA. */
+
+#include <config.h>
+
+#include <stdlib.h>
+
+#include <data/dictionary.h>
+#include <data/procedure.h>
+#include <language/command.h>
+#include <language/lexer/variable-parser.h>
+#include <libpspp/message.h>
+
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+
+/* Performs DELETE VARIABLES command. */
+int
+cmd_delete_variables (struct lexer *lexer, struct dataset *ds)
+{
+ struct variable **vars;
+ size_t var_cnt;
+
+ if (proc_make_temporary_transformations_permanent (ds))
+ msg (SE, _("DELETE VARIABLES may not be used after TEMPORARY. "
+ "Temporary transformations will be made permanent."));
+
+ if (!parse_variables (lexer, dataset_dict (ds), &vars, &var_cnt, PV_NONE))
+ goto error;
+ if (var_cnt == dict_get_var_cnt (dataset_dict (ds)))
+ {
+ msg (SE, _("DELETE VARIABLES may not be used to delete all variables "
+ "from the active file dictionary. Use NEW FILE instead."));
+ goto error;
+ }
+
+ if (!procedure (ds, NULL, NULL))
+ goto error;
+
+ dict_delete_vars (dataset_dict (ds), vars, var_cnt);
+ free (vars);
+
+ return CMD_SUCCESS;
+
+ error:
+ free (vars);
+ return CMD_CASCADING_FAILURE;
+}
+Wed Dec 13 21:00:24 2006 Ben Pfaff <blp@gnu.org>
+
+ * variable-parser.c (parse_variables): If not successful, set
+ output pointer to NULL and output count to 0.
+
Sat Dec 9 18:46:11 2006 Ben Pfaff <blp@gnu.org>
* variable-parser.h: New PV_SAME_WIDTH variable parsing option.
vs = var_set_create_from_dict (d);
success = parse_var_set_vars (lexer, vs, var, cnt, opts);
- if ( success == 0 )
- free ( *var ) ;
+ if ( success == 0 )
+ {
+ free ( *var ) ;
+ *var = NULL;
+ *cnt = 0;
+ }
var_set_destroy (vs);
return success;
}
+Wed Dec 13 21:00:46 2006 Ben Pfaff <blp@gnu.org>
+
+ * command/rank.sh (activity): Use DELETE VAR (which is new)
+ instead of MODIFY VARS.
+
Tue Dec 19 08:17:28 2006 Ben Pfaff <blp@gnu.org>
* command/loop.sh: Test all the possible combinations of clauses.
RANK x.
-MODIFY VARS /drop ran001 TO ran999.
+DELETE VAR ran001 TO ran999.
LIST.