I would loop over all columns in the data table and remove when needed (if you want to keep to your idea, I can also help debugging that):
Names Default To Here(1);
bigClass = Open("$SAMPLE_DATA/Big Class.JMP");
dt = Current Data Table();
col_of_interest = {"name", "age", "weight"};
col_names = dt << Get Column Names(String);
For(i = 1, i <= N Items(col_names), i++,
If(!Contains(col_of_interest, col_names[i]),
dt << Delete Columns(col_names[i]);
);
);
Wait(0);
Also I would suggest not using J as variable name, as JMP has a matrix function J().
Edit:
Also there is no need to use Current Data Table() (and you shouldn't) because you already have the reference after opening the table. Also here is my preferred method to remove columns (using associative array to get only the extra columns and removing those):
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.JMP");
col_of_interest = {"name", "age", "weight"};
//get columns which are "extra"
col_names_aa = Associative Array(dt << Get Column Names(String));
col_names_aa << Remove(Associative Array(col_of_interest));
col_names_to_remove = col_names_aa << get keys;
Show(col_names_to_remove);
dt << Delete Columns(col_names_to_remove);
-Jarmo