-
- return v;
-}
-
-/* Creates and returns a clone of OLD_VAR. Most properties of
- the new variable are copied from OLD_VAR, except:
-
- - The variable's short name is not copied, because there is
- no reason to give a new variable with potentially a new
- name the same short name.
-
- - The new variable is not added to OLD_VAR's dictionary by
- default. Use dict_clone_var, instead, to do that.
-
- - Auxiliary data and obs_vals are not copied. */
-struct variable *
-var_clone (const struct variable *old_var)
-{
- struct variable *new_var = var_create (var_get_name (old_var),
- var_get_width (old_var));
-
- var_set_missing_values (new_var, var_get_missing_values (old_var));
- var_set_print_format (new_var, var_get_print_format (old_var));
- var_set_write_format (new_var, var_get_write_format (old_var));
- var_set_value_labels (new_var, var_get_value_labels (old_var));
- var_set_label (new_var, var_get_label (old_var));
- var_set_measure (new_var, var_get_measure (old_var));
- var_set_display_width (new_var, var_get_display_width (old_var));
- var_set_alignment (new_var, var_get_alignment (old_var));
- var_set_leave (new_var, var_get_leave (old_var));
- var_set_attributes (new_var, var_get_attributes (old_var));
-
- return new_var;
-}
-
-/* Create a variable of the specified WIDTH to be used for
- internal calculations only. The variable is assigned a unique
- dictionary index and a case index of CASE_IDX. */
-struct variable *
-var_create_internal (int case_idx, int width)
-{
- struct variable *v = var_create ("$internal", width);
- struct vardict_info vdi;
- static int counter = INT_MAX / 2;
-
- vdi.dict = NULL;
- vdi.case_index = case_idx;
- vdi.dict_index = counter++;
- if (counter == INT_MAX)
- counter = INT_MAX / 2;
-
- var_set_vardict (v, &vdi);