Creating two new tables based on filtering one columnI have two types (RFR, OUT) in one column, and would like to generate two tables from this labeled "RFR.jmp" and "OUT.jmp", but can't seem to simply figure out how to do this best:
obj = dt1 << Data Filter( Add Filter( columns( :Code Type ), where( :Code Type == {"RFR"} ) ) );
df = dt1 << subset( selected rows( 1 ), selected columns( 0 ) );
df << Save( "RFR_2014.jmp" );
df << clear select
Wait(0.1);
obj = dt1 << Data Filter( Add Filter( columns( :Code Type ), where( :Code Type == {"OUT"} ) ) );
df = dt1 << subset( selected rows( 1 ), selected columns( 0 ) );
df << Save( "OUT_2014.jmp" );
df << clear selectThe selection from the previous RFR doesn't appear to clear at all, and therefore it just joins multiple of the RFR column into one data table. I'm guessing this has to do with setting of the current data table... but how do I get control of this?
Any thoughts?
Re: Creating two new tables based on filtering one columnI think the code below is simpler, when you get rid of the Data Filter. Also, the Wait(0) will allow the subsets and the selections to be made, prior to executing the next statements.
dt1 << select where(:Code Type == "RFR" );
wait(0);
df = dt1 << subset( selected rows( 1 ), selected columns( 0 ) );
df << Save( "RFR_2014.jmp" );
wait(0);
dt1 << select where(:Code Type == "OUT");
wait(0);
df = dt1 << subset( selected rows( 1 ), selected columns( 0 ) );
df << Save( "OUT_2014.jmp" );