Here is a sample script that will do the trick:
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\Big Class.jmp" );
dt << select where( :SEX == "F" );
dtsubset = dt << subset( selected rows( 1 ), selected columns( 0 ), output table name( "The Subset" ) );
Eval(Substitute(
Expr(
dt << new script( "Subset Script", __script__ )
),
Expr( __script__ ), dtsubset << get script
));
Jim