JMP formula definition will not evaluate when being defined, only when run. Therefore, the formula needs to be presented to JMP in a fully defined form.
Column( colname[i] ) / Column( colby[i] )
needs to presented to JMP as
Column( "B" ) / Column( "A" )
Using the Substitute function allows for the expanding of the code as required
// Add new columns to the split data table
For( i = 1, i <= N Items( colname ), i++,
Eval(
Substitute(
Expr(
dt2 << New Column( colname[i] || "/" || colby[i],
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula( Column( __colname__ ) / Column( __colby__ ) )
)
),
Expr( __colname__ ), colname[i],
Expr( __colby__ ), colby[i]
)
)
);
Jim