Using JMP > Formula Editor > Examples and Tutorials > Use Local Variables in a Formula
Publication date: 10/01/2019

Use Local Variables in a Formula

Suppose you want to compute the slope in a simple linear regression of y on x using the standard formula shown in Figure 7.21. One way to do this is to create two local variables, and name them XY and Xsqrd. (See Use Local Variables.) Then assign them to the numerator and the denominator calculations of the slope formula. Delimit each assignment with a semicolon, as shown in Figure 7.21. (Statements in the Formula Editor are actually JSL programming statements. Multiple statements in a formula must be separated by a semicolons.) The slope computation is simplified to XY divided by Xsqrd.

Figure 7.21 Local Variables in a Standard Slope Formula 

Note: You can also create local variables using the button on the on-screen keypad. Clicking this button creates a local variable with a default name in an expression and places a semicolon after it. The default name is t1, and additional local variables are named t2, t3, and so on. You can change these default names by double-clicking and editing the name. However, you must be careful to rename each instance of the variable to avoid errors.

Want more information? Have questions? Get answers in the JMP User Community.