Next: , Previous: , Up: Variables   [Contents][Index]

2.5.7 GUI Attributes

These functions and types access and set attributes that are mainly used by graphical user interfaces. Their values are also stored in and retrieved from system files (but not portable files).

The first group of functions relate to the measurement level of numeric data. New variables are assigned a nominal level of measurement by default.

Enumeration: enum measure

Measurement level. Available values are:


Numeric data values are arbitrary. Arithmetic operations and numerical comparisons of such data are not meaningful.


Numeric data values indicate progression along a rank order. Arbitrary arithmetic operations such as addition are not meaningful on such data, but inequality comparisons (less, greater, etc.) have straightforward interpretations.


Ratios, sums, etc. of numeric data values have meaningful interpretations.

PSPP does not have a separate category for interval data, which would naturally fall between the ordinal and scale measurement levels.

Function: bool measure_is_valid (enum measure measure)

Returns true if measure is a valid level of measurement, that is, if it is one of the enum measure constants listed above, and false otherwise.

Function: enum measure var_get_measure (const struct variable *var)
Function: void var_set_measure (struct variable *var, enum measure measure)

Gets or sets var’s measurement level.

The following set of functions relates to the width of on-screen columns used for displaying variable data in a graphical user interface environment. The unit of measurement is the width of a character. For proportionally spaced fonts, this is based on the average width of a character.

Function: int var_get_display_width (const struct variable *var)
Function: void var_set_display_width (struct variable *var, int display_width)

Gets or sets var’s display width.

Function: int var_default_display_width (int width)

Returns the default display width for a variable with the given width. The default width of a numeric variable is 8. The default width of a string variable is width or 32, whichever is less.

The final group of functions work with the justification of data when it is displayed in on-screen columns. New variables are by default right-justified.

Enumeration: enum alignment

Text justification. Possible values are ALIGN_LEFT, ALIGN_RIGHT, and ALIGN_CENTRE.

Function: bool alignment_is_valid (enum alignment alignment)

Returns true if alignment is a valid alignment, that is, if it is one of the enum alignment constants listed above, and false otherwise.

Function: enum alignment var_get_alignment (const struct variable *var)
Function: void var_set_alignment (struct variable *var, enum alignment alignment)

Gets or sets var’s alignment.

Next: , Previous: , Up: Variables   [Contents][Index]