Here is an example of one way to do this
// Open a file and create 2 subsets and then save all 3 files to
// different folders, keeping the files open in the JMP session,
// and with their original name, but naming each subset in their
// folders where they are saved
Names Default To Here( 1 );
// open the Big Class data table.
dt = Open( "$SAMPLE_DATA/big class.jmp" );
// Create subset one with all Males, letting JMP provide the new data table name
dt << select where( :sex == "M" );
dtA = dt << subset( selected columns( 0 ), selected rows( 1 ) );
// Create subset two with all Females, giving JMP the name of the new table
dt << select where( :sex == "F" );
dtB = dt << subset( selected columns( 0 ), selected rows( 1 ), Output Table( "All Females" ) );
// The Save() function automatically changes the name of the data table being saved
// to the name being specified in the file name specified in the Path of the Save()
// function. Therefore to keep the original table the original name, it has to be
// renamed back to the original name.
holdName = dt << get name;
dt << save( "C:/folderA/MyName.jmp" );
dt << set name( holdName );
// Repeat the save for the first subset
holdName = dtA << get name;
dtA << save( "C:/folderB/MyName.jmp" );
dtA << set name( holdName );
// Repeat for the second subset. The name of this subset has been specifically provided
// so the handling of this can be a little different
Data Table( "All Females" ) << save( "C:/folderC/MyName.jmp" );
Data Table( "MyName" ) << set name( "All Females" );
Jim