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


2.5.1 Variable Name

A variable name is a string between 1 and ID_MAX_LEN bytes long that satisfies the rules for PSPP identifiers (see Tokens in PSPP Users Guide). Variable names are mixed-case and treated case-insensitively.

Macro: int ID_MAX_LEN

Maximum length of a variable name, in bytes, currently 64.

Only one commonly useful function relates to variable names:

Function: const char * var_get_name (const struct variable *var)

Returns var’s variable name as a C string.

A few other functions are much more rarely used. Some of these functions are used internally by the dictionary implementation:

Function: void var_set_name (struct variable *var, const char *new_name)

Changes the name of var to new_name, which must be a “plausible” name as defined below.

This function cannot be applied to a variable that is part of a dictionary. Use dict_rename_var instead (see Renaming Variables).

Function: enum dict_class var_get_dict_class (const struct variable *var)

Returns the dictionary class of var’s name (see Dictionary Class).