dt = Open( "$SAMPLE_DATA/Quality Control/Airport.jmp" );
dt << New Column( "ByVar", Character, formula( Left( :Day, 1 ) ) );
obj = Control Chart( Sample Size( :Day ), KSigma( 3 ), Chart Col( :Delay, XBar ), By( :ByVar ) );
Current Data Table( dt );
Summarize( byVals = By( :ByVar ) );
res = obj << SaveSummaries;
If( Is List( res ),
finalTable = res[1] << concatenate( res[2 :: N Items( res )], create source column, outputTableName( "Saved Summaries" ) );
Try(
col = Column( finalTable, "Source Table" );
col << set name( dt:ByVar << get name );
For( i = 1, i <= N Items( res ), i++,
col[finalTable << get rows where( Column( dt:ByVar << get name )[] == (res << get name) )] = byVals;
Close( res, NoSave );
);
,
finalTable = res
);
);