PSPP variable names may be up to 64 (
ID_MAX_LEN) bytes long.
The system and portable file formats, however, were designed when
variable names were limited to 8 bytes in length. Since then, the
system file format has been augmented with an extension record that
explains how the 8-byte short names map to full-length names
(see Long Variable Names Record), but the short names are still
present. Thus, the continued presence of the short names is more or
less invisible to PSPP users, but every variable in a system file
still has a short name that must be unique.
PSPP can generate unique short names for variables based on their full names at the time it creates the data file. If all variables’ full names are unique in their first 8 bytes, then the short names are simply prefixes of the full names; otherwise, PSPP changes them so that they are unique.
By itself this algorithm interoperates well with other software that can read system files, as long as that software understands the extension record that maps short names to long names. When the other software does not understand the extension record, it can produce surprising results. Consider a situation where PSPP reads a system file that contains two variables named RANKINGSCORE, then the user adds a new variable named RANKINGSTATUS, then saves the modified data as a new system file. A program that does not understand long names would then see one of these variables under the name RANKINGS—either one, depending on the algorithm’s details—and the other under a different name. The effect could be very confusing: by adding a new and apparently unrelated variable in PSPP, the user effectively renamed the existing variable.
To counteract this potential problem, every
struct variable may have
a short name. A variable created by the system or portable file
reader receives the short name from that data file. When a variable
with a short name is written to a system or portable file, that
variable receives priority over other long names whose names begin
with the same 8 bytes but which were not read from a data file under
that short name.
Variables not created by the system or portable file reader have no short name by default.
A variable with a full name of 8 bytes or less in length has absolute priority for that name when the variable is written to a system file, even over a second variable with that assigned short name.
PSPP does not enforce uniqueness of short names, although the short names read from any given data file will always be unique. If two variables with the same short name are written to a single data file, neither one receives priority.
The following macros and functions relate to short names.
Maximum length of a short name, in bytes. Its value is 8.
Returns var’s short name, or a null pointer if var has not been assigned a short name.
Sets var’s short name to short_name, or removes var’s short name if short_name is a null pointer. If it is non-null, then short_name must be a plausible name for a variable. The name will be truncated to 8 bytes in length and converted to all-uppercase.
Removes var’s short name.