This version of the Help is no longer updated. See JMP.com/help for the latest version.

.
Using JMP > Formula Editor > Use Local Variables
Publication date: 07/30/2020

Use Local Variables

You can create and use temporary numeric variables in expressions. You can use ordinary local variables or you can use parameters, which are special types of local variables. Local variables exist only for the evaluation of the formula in which they are defined. They appear in formulas as bold italic terms.

Local variables are most often used with Assignment functions, which can assign expressions to local variables that are used in a complex equation. See Assignment Functions in the Formula Functions Reference section. This technique can sometimes simplify building an equation and improve the efficiency of its evaluation.

To build a formula that references values found in local variables, follow these steps:

Step 1: Create the Local Variable

1. Open the Formula Editor by right-clicking a column name in the data table and selecting Formula.

2. Select a box in the formula editing area by clicking it. (It is selected when there is a blue outline around it.)

3. In the middle pane of the Formula Editor, select Local Variables from the list.

4. Click New Local.

5. Enter a name for the local variable. By default, local variables have the names t0, t1, and so on, and have missing values.

6. Assign a starting value, and click OK.

7. (Optional) To copy, edit, or delete a local variable, right-click (Ctrl-click on the macOS) its name and select Copy, Edit, or Delete.

Step 2: Insert a Local Variable into a Formula

1. Select a term in the formula editing area by clicking it. (It is selected when there is a blue outline around it.)

2. Click the local variable name in the Local Variables list. It appears in the formula as a bold italic term.

Notes:

Double-clicking or pressing Alt and clicking the local variable replaces the portion of the formula that is selected.

Another way to create local variables is to use the Make Temporary Variable button on the Formula Editor keypad. The button automatically creates and displays local variables and places a semicolon after it. See Add Operators.

You can also create a local variable from an expression. Right-click the expression in the Formula Editor and select Create Local Variable from Expression.

Pressing Alt and Shift and clicking enables you to edit the selected variable in place instead of in a new window.

See Use Local Variables in a Formula for an example of referencing local variables in a formula.

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