If you can avoid getting the name of the column as a string, and get the column object instead, it might be easier. Below, cols is a list of column objects, not their names.
colListY = {"Plating Thickness (m\!"\!")"};
dt = Open( "$sample_data/big class.jmp" );
dt:age << setname( colListY[1] );
cols = dt << getcolumnnames;// don't use the string keyword
/* {name, "Plating Thickness (m\!"\!")"n, sex, height, weight} */
script = Expr(
Fit Model(
Y( :weight ),
Effects( F1 ),
Personality( "Standard Least Squares" ),
Run(
:weight << {Plot Actual by Predicted( 1 ), Plot Residual by Predicted( 1 ),
Plot Effect Leverage( 1 )}
)
)
);
Substitute Into( script, Expr( F1 ), cols[2] );
Write( Name Expr( script ) );
/*
Fit Model(
Y( :weight ),
Effects( "Plating Thickness (m\!"\!")"n ),
Personality( "Standard Least Squares" ),
Run(
:weight << {Plot Actual by Predicted( 1 ), Plot Residual by Predicted( 1 ),
Plot Effect Leverage( 1 )}
)
);
*/
Craige