String Variable Formats

  • The values of string variables can contain numbers, letters, and special characters and can be up to 32,767 bytes.
  • System-missing values cannot be generated for string variables, since any character is a legal string value.
  • When a transformation command that creates or modifies a string variable yields a missing or undefined result, a null string is assigned. The variable displays as blanks and is not treated as missing.
  • String formats are used to read and write string variables. The input values can be alphanumeric characters (A format) or the hexadecimal representation of alphanumeric characters (AHEX format).
  • For fixed-format raw data, the width can be explicitly specified on commands such as DATA LIST and GET DATA or implied if column-style specifications are used. For freefield data, the default width is 1; if the input string may be longer, w must be explicitly specified. Input strings shorter than the specified width are right-padded with blanks.
  • The output format for a string variable is always A. The width is determined by the input format or the format assigned on the STRING command. Once defined, the width of a string variable can only be changed with the ALTER TYPE command.