Next: , Up: Basic Concepts   [Contents][Index]

2.1 Values

The unit of data in PSPP is a value.

Values are classified by type and width. The type of a value is either numeric or string (sometimes called alphanumeric). The width of a string value ranges from 1 to MAX_STRING bytes. The width of a numeric value is artificially defined to be 0; thus, the type of a value can be inferred from its width.

Some support is provided for working with value types and widths, in data/val-type.h:

Macro: int MAX_STRING

Maximum width of a string value, in bytes, currently 32,767.

Function: bool val_type_is_valid (enum val_type val_type)

Returns true if val_type is a valid value type, that is, either VAL_NUMERIC or VAL_STRING. Useful for assertions.

Function: enum val_type val_type_from_width (int width)

Returns VAL_NUMERIC if width is 0 and thus represents the width of a numeric value, otherwise VAL_STRING to indicate that width is the width of a string value.

The following subsections describe how values of each type are represented.