ASSIGN lets you assign a value to the contents of a variable or record/column location or to a new or existing variable or record/column location. The ASSIGN keyword is only required if it is preceded by IF logic in the Glossary.
The ASSIGN keyword is optional for the following syntaxes:
Syntax 1:
ASSIGN variable name = (value)
or
ASSIGN record/column:width = (value)
or
variable name = (value)
or
record/column:width = (value)
Syntax 2:
ASSIGN new variable name = original variable name
or
ASSIGN new record/column:width = original record/column: width
or
new variable name = original variable name
or
new record/column:width = original record/column: width
Abbreviation: ASS
Usage:
One use of ASSIGN is to copy a value to a new variable or record/column location. For example, if you want to recode a single-column value to a multi-column value, you first write an ASSIGN statement and then a RECODE statement.
You can also use ASSIGN to assign a value to an existing variable or record/column location, copy a value from one variable or record/column location to another and to create a new value based on a condition.
ASSIGN will overwrite the original value with the new value.
Important information:
Note: When using Repeat with the ASSIGN command, the variables must all be the same width. Use View|Data File Information to determine the width for each variable. |
Related topics: