String expressions

Expressions involving string variables can be used on COMPUTE and IF commands and in logical expressions on commands such as IF, DO IF, LOOP IF, and SELECT IF.

  • A string expression can be a constant enclosed in quotes (for example, ‘IL’), a string function, or a string variable. See the topic String functions for more information.
  • An expression must return a string if the target variable is a string.
  • The string returned by a string expression does not have to be the same length as the target variable; no warning messages are issued if the lengths are not the same. If the target variable produced by a COMPUTE command is shorter, the result is right-trimmed. If the target variable is longer, the result is right-padded.