Next: , Previous: Initializing User-Missing Value Sets, Up: User-Missing Values


2.3.3 Changing User-Missing Value Set Width

A few PSPP language constructs copy sets of user-missing values from one variable to another. When the source and target variables have the same width, this is simple. But when the target variable's width might be different from the source variable's, it takes a little more work. The functions described here can help.

In fact, it is usually unnecessary to call these functions directly. Most of the time var_set_missing_values, which uses mv_resize internally to resize the new set of missing values to the required width, may be used instead. See var_set_missing_values, for more information.

— Function: bool mv_is_resizable (const struct missing_values *mv, int new_width)

Tests whether mv's width may be changed to new_width using mv_resize. Returns true if it is allowed, false otherwise.

If new_width is a long string width, mv may be resized only if it is empty. Otherwise, if mv contains any missing values, then it may be resized only if each missing value may be resized, as determined by value_is_resizable (see value_is_resizable).

— Function: void mv_resize (struct missing_values *mv, int width)

Changes mv's width to width. mv and width must satisfy the constraints explained above.

When a string missing value set's width is increased, each user-missing value is padded on the right with spaces to the new width.