Publication date: 07/08/2024

Assignment Functions

In the JMP Formula Editor, Assignment functions work in place. That is, the result returned by the operation (on the right of the operator) is stored in the argument on the left of the operator and replaces its current value.

Assignment statements are most often used in conjunction with other commands to build a JSL script. You can use the Formula Editor to create and execute a script in that column, but this is not recommended because of dependencies and ambiguities that can result. Most often, scripts are stored as .jsl files, and can be saved with a data table. See Create and Save Scripts in Data Tables. For more information about syntax, see Assignment Functions in the JSL Syntax Reference.

Note: The first argument of an assignment function must be capable of being assigned. This means you cannot have an assignment such as 3+=4, because 3 is a constant value that cannot be reassigned. You must first create a variable (a table variable or local variable) whose value is 3. (For more information about table variables, see Use Data Table Variables. For more information about local variables, see Refer to Data Table Values in Formulas). Then use that variable as the left-hand argument of the assignment function.

= (assign)

Puts the value of b into a. For example (a=b).

+= (add to)

Adds the value of b to a and puts the result back into a. For example, a+=b.

-= (subtract to)

Subtracts the value of b and puts the result back into a. For example, a–=b.

*= (multiply to)

Multiplies b with a and puts the result back into a. For example, a*=b.

/= (divide to)

Divides b into a and puts the result back into a. For example, a/=b.

++ (post increment)

Adds one (1) to a, in place, so that a++. For example, if the initial value of a is 4, the expression a++ changes a to 5.

-- (post decrement)

Subtracts one (1) from a, in place, so that a– – . For example, if the initial value of a is 4, the expression a– – changes a to 3.

Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).