A numeric or short string variable may have a set of value labels
(see VALUE LABELS), represented as a
struct val_labs (see Value Labels). The most commonly useful
functions for value labels return the value label associated with a
Looks for a label for value in var's set of value labels. Returns the label if one exists, otherwise a null pointer.
Looks for a label for value in var's set of value labels. If a label exists, it will be appended to the string pointed to by str. Otherwise, it formats value using var's print format (see Input and Output Formats) and appends the formatted string.
struct val_labs structure may also be accessed
directly using the functions described below.
Returns true if var has at least one value label, false otherwise.
struct val_labsassociated with var. If var has no value labels, then the return value may or may not be a null pointer.
The variable retains ownership of the returned
struct val_labs, which the caller must not attempt to modify.
Replaces var's value labels by a copy of val_labs. The caller retains ownership of val_labs. If val_labs is a null pointer, then var's value labels, if any, are deleted.
Deletes var's value labels. Equivalent to
A final group of functions offers shorthands for operations that would otherwise require getting the value labels from a variable, copying them, modifying them, and then setting the modified value labels into the variable (making a second copy):
Attempts to add a copy of label as a label for value for the given var. If value already has a label, then the old label is retained. Returns true if a label is added, false if there was an existing label for value or if var is a long string variable. Either way, the caller retains ownership of value and label.
Attempts to add a copy of label as a label for value for the given var. If value already has a label, then label replaces the old label. Either way, the caller retains ownership of value and label.
If var is a long string variable, this function has no effect.