Hi,
The issue here seems to be the table variables that were created for each subset. Table variables with the same name ("age") were then getting added as columns with each concatenation. See script below, and notice the For-loop added to delete the table variables. Does this resolve the issue for you?
// Open Big Class data table
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
//Subset the data table by age
listDT = dt << Subset(
By( :age ),
All rows,
Selected columns only( 0 ),
columns( :name, :sex, :height, :weight )
);
//Select first row of each subset data table
For( i = 1, i <= N Items( listDT ), i++,
listDT[i] << Select Rows( {1} );
listDT[i] << Subset("");
Close(listDT[i],"No Save");
Close(dt,"No Save");
);
// Create Tables list
Tables = {};
For( i = 1, i <= N Table(), i++,
Insert Into( Tables, Data Table( i ) << get name );
);
//Delete table variables
For( i = 1, i <= N Table(), i++,
Data Table(Tables[i]) << Delete Table Variable("age");
);
//Create new table
New Table("FirstRowData");
// Run the concatenations
For( i = 1, i <= N Items( Tables ), i++,
Data Table( "FirstRowData" ) << Concatenate(
Data Table( Tables[i] ),
append to first table(1)
);
Close( Data Table( Tables[i] ), No Save );
);