SET

Assigns a new value to a specified variable.
Category: Manipulating DATA Step Variables
Alias: None

Syntax

SET variable=expression

Required Arguments

variable
specifies the name of a DATA step variable or an array reference.
expression
is any debugger expression.
Tip:expression can contain the variable name that is used on the left side of the equal sign. When a variable appears on both sides of the equal sign, the debugger uses the original value on the right side to evaluate the expression and stores the result in the variable on the left.

Details

The SET command assigns a value to a specified variable. When you detect an error during program execution, you can use this command to assign new values to variables. This enables you to continue the debugging session.

Example

  • Set the variable A to the value of 3:
    set a=3
  • Assign to the variable B the value 12345 concatenated with the previous value of B:
    set b='12345' || b
  • Set array element ARR{1} to the result of the expression a+3:
    set arr{1}=a+3
  • Set array element CRR{1,2,3} to the result of the expression crr{1,1,2} + crr{1,1,3}:
    set crr{1,2,3} = crr{1,1,2} + crr{1,1,3}
  • Set the variable A to the result of the expression a+c*3:
    set a=a+c*3