Yoga,
There are multple methods to add a script to a data table. I think JMP could make it easier. As an FYI, this script shows just 3 methods to add a script.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
myScript = Expr(Distribution( Column( :Height, :Weight ), By( :sex )) );
//---hard coded method below
//dt << New Script("New Script",Distribution( Column( :Height, :Weight ), By( :sex )) );
//--or use the syntax below that uses expression substitution then Eval() to run it
//Eval( Substitute(Expr( dt << New Script( "New Script", _xx ) ), Expr(_xx), NameExpr(myScript) ) );
//---or use Eval Expr() that does the substitution and Eval() that runs it
Eval( Eval Expr(dt << New Script("New Script", Expr(NameExpr( myScript) ) ) ) );