Take a look in the Scripting index for the uses of Group Columns.
Here is one way of doing what you stated
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );
dt2 = New Table( "groupings",
New Column( "ID", character, set values( {"name", "age", "sex", "height", "weight"} ) ),
New Column( "Type", character, set values( {"A", "B", "C", "B", "A"} ) )
);
// Split data into columns based on Type
dtSplit = dt2 << Split( Split By( :Type ), Split( :ID ), Sort by Column Property );
// Process through the Split data table, creating the groups in the first data table
For( Group = 1, Group <= N Cols( dtSplit ), Group++,
theGroup = Column( dtSplit, Group ) << get values;
For(i=nitems(theGroup), i>=1,i--,if(theGroup[i] == "",
remove from(thegroup,i,1)));
grouping = dt << group columns( theGroup );
dt << Rename Column Group( grouping, (column(dtSplit, group)<<get name));
);
Jim