If you do not want to modify your script you could run it against a subset of each level of the identifier, like this:
Names default to here(1);
//Open some sample data
dt = Open( "$Sample_data/big class.jmp" );
//Your code
Identifiers = Column( "age") << GetAsMatrix();
Identifiers set = Associative Array( Identifiers);
Unique Identifiers = Identifiers set << Get Keys;
nUnique Identifiers = N Items (Unique Identifiers);
//A window to hold a bunch of graphs
win = New Window("Graphs", graphbox = v list box());
//Run an analysis on a subset of the data table for each level of a variable
for( i=1, i<=nUnique Identifiers, i++,
//Make a subset of the table with only values for this level
dt << Select Where( :age == UniqueIdentifiers[i]);
dtSub = dt << Subset("Selected Rows");
//run your existing script on the subset
//For demonstration, taking a picture of the graph builder platform
// and getting the R2 value from a linear model and adding those to a window
pic = (gb = dtSub << Graph Builder(
Size( 534, 456 ),
Show Control Panel( 0 ),
Variables( X( :height ), Y( :weight ) ),
Elements( Points( X, Y, Legend( 2 ) ) ),
Local Data Filter(
Close Outline( 1 ),
Add Filter(
columns( :age ),
Where( :age == Unique Identifiers[i] ),
Display( :age, N Items( 6 ) )
)
)
)) << Get Picture;
graphbox << Append( pic );
gb << Close Window;
fm = dtSub << Fit Model(
Y( :height ),
Effects( :weight ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run(
:height << {Summary of Fit( 1 ), Analysis of Variance( 1 ),
Parameter Estimates( 1 ), Scaled Estimates( 0 ),
Plot Actual by Predicted( 1 ), Plot Residual by Predicted( 1 ),
Plot Studentized Residuals( 0 ), Plot Effect Leverage( 1 ),
Plot Residual by Normal Quantiles( 0 ), Box Cox Y Transformation( 0 )}
)
);
Wait( 0 );
dtSum = Report( fm )[Outline Box( "Response height" )][Outline Box( "Whole Model" )][
Outline Box( "Summary of Fit" )][Table Box( 1 )] << Make Into Data Table;
Report( fm ) << Close Window;
Rsq = dtSum:Column 2[1];
graphbox << Append( Text Box( "RSquared was " || char(Rsq) ) );
dtSum << Close Window;
//close the subset
dtSub << Close Window;
);