Jim is correct.
Without Names Default To Here(1), all variables are global. The JMP Scripting Guide states
"When a global variable and a column have the same name, ... In this situation, you must scope the column name."
In fact, when I run the script, I get the error
Cannot set value for the column 'age' because the row number (-1) is not valid.
Since it is not ::age, JMP thinks the statement age=13 is trying to assign values to the column named age. Names Default To Here(1) makes the variable "age" local and resolves this conflict. However, I strongly recommend that you use Names Default to Here(1) and use a different name for user input like, _age or usr_val. I believe name collisions (conflicts, a.k.a. scoping) is the second highest occuring scripting error after syntax and typos.
The script below is a slight modification of Jim's:
- _age is assigned a value
- an alternative to Fit Where(). Selecting the values to be used and then using Group By() will provide the name for each Group By value.
names default to here(1);
dt=open("$SAMPLE_DATA/big class.jmp");
_age=13;
biv = dt << Bivariate(
Y( :weight),
X( :height),
Show Points( 0 ),
where(:age==12 | :age==_age),
Group By(:age),
Fit Each Value( {Report(0)}),
By(:sex)
);
biv << ( Curve[1] << Line Color ( {0, 0, 255 } ) );
biv << ( Curve[2] << Line Color ( {213, 72, 255 } ) );