Overview (STRING command)

STRING declares new string variables that can be used as target variables in data transformations.

Basic Specification

The basic specification is the name of the new variables and, in parentheses, the variable format.

Syntax Rules

  • If keyword TO is used to create multiple string variables, the specified format applies to each variable that is named and implied by TO.
  • To declare variables with different formats, separate each format group with a slash.
  • STRING can be used within an input program to determine the order of string variables in the dictionary of the active dataset. When used for this purpose, STRING must precede DATA LIST in the input program. See the examples for the NUMERIC command.
  • STRING cannot be used to redefine an existing variable.
  • String variables cannot have zero length; A0 is an illegal format.
  • All implementations of the program allow the A format. Other string formats may be available on some systems. In addition, the definition of a long string depends on your operating system. Use keyword LOCAL on the INFO command to obtain documentation for your operating system.

Operations

  • STRING takes effect as soon as it is encountered in the command sequence. Therefore, pay special attention to the position of STRING among commands. See the topic Command Order for more information.
  • New string variables are initialized as blanks.
  • Variables that are declared on STRING are added to the active dataset in the order in which they are specified. This order is not changed by the order in which the variables are used in the transformation language.
  • To change the defined width of a string variable use the ALTER TYPE command. See the topic ALTER TYPE for more information.