Quite a lot of assumptions made regarding column names and column ordering
Names Default To Here(1);
dt = New Table("Untitled",
Add Rows(1),
Compress File When Saved(1),
New Column("Name", Character, "Nominal", Set Values({})),
New Column("Column1", Numeric, "Continuous", Format("Best", 12), Set Values([1])),
New Column("Column2", Numeric, "Continuous", Format("Best", 12), Set Values([2])),
New Column("Column1_1", Numeric, "Continuous", Format("Best", 12), Set Values([2])),
New Column("Column2_1", Numeric, "Continuous", Format("Best", 12), Set Values([4]))
);
all_colnames = dt << Get Column Names("String");
Remove From(all_colnames, 1); // Drop first column
For Each({col_name}, all_colnames[1::(N Items(all_colnames)/2)],
Eval(Substitute(
Expr(
dt << New Column(col_name|| "_cal", Numeric, Continuous, Formula(
_firstcol_ - _secondcol_
));
),
Expr(_firstcol_), Name Expr(AsColumn(col_name)),
Expr(_secondcol_), Name Expr(AsColumn(col_name || "_1"))
));
);
Scripting Index and Scripting Guide have good information regarding JMP Scripting. Insert one expression into another using Eval Insert, Eval Expr, Parse, and Substitute is good post regarding how to build formulas from variables
-Jarmo