Only rarely should PSPP code create or destroy variables directly. Ordinarily, variables are created within a dictionary and destroying by individual deletion from the dictionary or by destroying the entire dictionary at once. The functions here enable the exceptional case, of creation and destruction of variables that are not associated with any dictionary. These functions are used internally in the dictionary implementation.
Creates and returns a new variable with the given name and width. The new variable is not part of any dictionary. Use
dict_create_var, instead, to create a variable in a dictionary (see Dictionary Creating Variables).
The new variable has no user-missing values, value labels, or variable label. Numeric variables initially have F8.2 print and write formats, right-justified display alignment, and scale level of measurement. String variables are created with A print and write formats, left-justified display alignment, and nominal level of measurement. The initial display width is determined by
Creates and returns a new variable with the same attributes as old_var, with a few exceptions. First, the new variable is not part of any dictionary, regardless of whether old_var was in a dictionary. Use
dict_clone_var, instead, to add a clone of a variable to a dictionary.
Second, the new variable is not given any short name, even if old_var had a short name. This is because the new variable is likely to be immediately renamed, in which case the short name would be incorrect (see Variable Short Names).
Finally, old_var's auxiliary data, if any, is not copied to the new variable (see Variable Auxiliary Data).
Destroys var and frees all associated storage, including its auxiliary data, if any. var must not be part of a dictionary. To delete a variable from a dictionary and destroy it, use
dict_delete_var(see Dictionary Deleting Variables).