Here is a very simple way of doing what you are requesting, and it is expandable into much more complex requirements
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );
colList = dt << get column names( string );
dt << clear column selection;
For( i = 1, i <= N Items( colList ), i++,
If(
// Put in any selection criteria you want
Left( colList[i], 2 ) == "PN" ,
// or it could be
// contains( colList[i], "PN") == 1,
Column( dt, colList[i] ) << set selected
)
);
If( N Items( dt << get selected columns ) > 0,
dtSelected = dt << subset( selected rows( 0 ), selected columns( 1 ) )
);
Jim