Here is a simple example using an Expr() to hold the script to be used multiple times
names default to here( 1 );
// Open Data Table: Big Class.jmp
// → Data Table( "Big Class" )
Open( "$SAMPLE_DATA/Big Class.jmp" );
summarize( ageList = by( :Age ) );
// Here is the script that will be applied to each data table
theScript = Expr(
dt << new column( "Ratio", formula( :height / :weight ) );
dt << set name( "The Table Name is Age=" || ageList[i])
);
// Create a data table for each level of Age in the data table.
// The list called dtList will contain a refereence to each individual
// table created
dtList = Data Table( "Big Class" ) << Subset(
Output Table( "Untitled 2.jmp" ),
By( :age ),
All rows,
Selected columns only( 0 ),
columns( :name, :sex, :height, :weight )
);
show( dtList );
For( i = 1, i <= n items( dtList ), i++,
dt = dtList[i];
// Run the script
theScript;
);
You may also want to look into the "Include()" function.
Jim