These functions modify the contents of struct missing_values
objects.
The next set of functions applies to all sets of user-missing values:
bool
mv_add_value (struct missing_values *mv, const union value *value)
¶bool
mv_add_str (struct missing_values *mv, const char value[])
¶bool
mv_add_num (struct missing_values *mv, double value)
¶Attempts to add the given discrete value to set of user-missing
values mv. value must have the same width as mv.
Returns true if value was successfully added, false if the set
could not accept any more discrete values or if value is not an
acceptable user-missing value (see mv_is_acceptable
below).
These functions are equivalent, except for the form in which value is provided, so you may use whichever function is most convenient.
void
mv_pop_value (struct missing_values *mv, union value *value)
¶Removes a discrete value from mv (which must contain at least one discrete value) and stores it in value.
bool
mv_replace_value (struct missing_values *mv, const union value *value, int index)
¶Attempts to replace the discrete value with the given index in
mv (which must contain at least index + 1 discrete values)
by value. Returns true if successful, false if value is
not an acceptable user-missing value (see mv_is_acceptable
below).
bool
mv_is_acceptable (const union value *value, int width)
¶Returns true if value, which must have the specified
width, may be added to a missing value set of the same
width, false if it cannot. As described above, all numeric
values and string values of width MV_MAX_STRING
or less may be
added, but string value of greater width may be added only if bytes
beyond the first MV_MAX_STRING
are all spaces.
The second set of functions applies only to numeric sets of user-missing values:
bool
mv_add_range (struct missing_values *mv, double low, double high)
¶Attempts to add a numeric range covering low…high (inclusive on both ends) to mv, which must be a numeric set of user-missing values. Returns true if the range is successful added, false on failure. Fails if mv already contains a range, or if mv contains more than one discrete value, or if low > high.
void
mv_pop_range (struct missing_values *mv, double *low, double *high)
¶Given mv, which must be a numeric set of user-missing values
that contains a range, removes that range from mv and stores its
low endpoint in *low
and its high endpoint in
*high
.