cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
tikhahabusamah
Level II

Script auto run all selected subset

Hi, 

is there any possibility to run all subset column by name which consist of more than 50 name automatically at the same time?

when I did subset by name, i get all those detail data I want, but I need to click one by one to run fit y by x analysis. is there is a way for me to select all and automatically run fit y by x analysis? all of this subset name might changes everytime. 

 

 

 

tikhahabusamah_0-1597773191628.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
ts2
ts2
Level III

Re: Script auto run all selected subset

FYI when subsetting you can assign your subset tables as a list rather than using N Table() which could be problematic if you have a bunch of other tables open (typically including the original table subset from).

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/big class.jmp" );

// Perform the subsets
listDT = dt << Subset(
	By( :age ),
	All rows,
	Selected columns only( 0 ),
	columns( :name, :sex, :height, :weight )
);

// Loop across all new data tables and run Fit Y by X
For( i = 1, i <= N Items( listDT ), i++,
	listDT[i] << Bivariate( Y( :height ), X( :weight ) )
);

View solution in original post

5 REPLIES 5
txnelson
Super User

Re: Script auto run all selected subset

Here is a little script that shows and example of one way to do what you want

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/big class.jmp" );

// Get the current number of data tables
numDT = N Table();

// Perform the subsets
dt << Subset(
	By( :age ),
	All rows,
	Selected columns only( 0 ),
	columns( :name, :sex, :height, :weight )
);

// Loop across all new data tables and run Fit Y by X
For( i = 1, i <= N Table() - numDT, i++,
	Data Table( i ) << Bivariate( Y( :height ), X( :weight ) )
);
Jim
tikhahabusamah
Level II

Re: Script auto run all selected subset

I try to did split by name after subset, which is before run table fit Y by X, but everytime I try to run JMP become not responding anymore. why?

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/big class.jmp" );

// Get the current number of data tables
numDT = N Table();

// Perform the subsets
dt << Subset( By( :age ), All rows, Selected columns only( 0 ), columns( :name, :sex, :height, :weight ) );

// Loop across all new data tables and run Fit Y by X
For( i = 1, i <= N Table() - numDT, i++,
    Data Table( i ) << Split( Split By( :name ), Split( :sex, :height, :weight ) )
);
txnelson
Super User

Re: Script auto run all selected subset

The issue is the stopping value for your For() loop.  You are specifying

For( i = 1, i <= N Table() - numDT, i++,

and then in your code you are creating a new data table, so the next time the loop happens, the value of 

N Table()

has increased by an additional count, so the variable 'i' can never get to the current value of N Table()

Jim
ts2
ts2
Level III

Re: Script auto run all selected subset

FYI when subsetting you can assign your subset tables as a list rather than using N Table() which could be problematic if you have a bunch of other tables open (typically including the original table subset from).

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/big class.jmp" );

// Perform the subsets
listDT = dt << Subset(
	By( :age ),
	All rows,
	Selected columns only( 0 ),
	columns( :name, :sex, :height, :weight )
);

// Loop across all new data tables and run Fit Y by X
For( i = 1, i <= N Items( listDT ), i++,
	listDT[i] << Bivariate( Y( :height ), X( :weight ) )
);
txnelson
Super User

Re: Script auto run all selected subset

@tikhahabusamah 

Remove my solution ( @txnelson ) and select @ts2  as the solution.  It is a better solution!

Jim