Previous: Variable Auxiliary Data, Up: Variables [Contents][Index]
Some statistical procedures require a list of all the values that a
categorical variable takes on. Arranging such a list requires making
a pass through the data, so PSPP caches categorical values in
struct variable
.
When variable auxiliary data is revamped to support multiple clients as described in the previous section, categorical values are an obvious candidate. The form in which they are currently supported is inelegant.
Categorical values are not robust against changes in the data. That is, there is currently no way to detect that a transformation has changed data values, meaning that categorical values lists for the changed variables must be recomputed. PSPP is in fact in need of a general-purpose caching and cache-invalidation mechanism, but none has yet been designed and built.
The following functions work with cached categorical values.
Returns var’s set of categorical values. Yields undefined behavior if var does not have any categorical values.
Destroys var’s categorical values, if any, and replaces them by cat_vals, ownership of which is transferred to var. If cat_vals is a null pointer, then var’s categorical values are cleared.
Returns true if var has a set of categorical values, false otherwise.