Subscribe Bookmark RSS Feed

select isn't selecting the right items

alex

Community Trekker

Joined:

Jun 23, 2011

Hi,

I have number of iterations of the below....where each one uses a different X & Y column. In 2 of these iterations the results are totally wrong and JMP selects a subset that is obviously wrong (lots of X < 40 and lots of Y that equal 1)

Any ideas?


//select X to get a list of items for this phase that need escalation
dt <<Clear Select;
dt <<Select Where( :X > 40 & :Y==0 );
dt <lt;Subset(output table name("X subset"));

edit to make code example show up

Message was edited by: alex

Message was edited by: alex

Message was edited by: alex

Message was edited by: alex

Message was edited by: alex
6 REPLIES
ms

Super User

Joined:

Jun 23, 2011

Maybe the row selection is not always able to match the iteration rate, i.e. the subset is created before the row selection is finished.

Try to insert a Wait(0.5) command in each iteration (experiment with different arguments, sometimes Wait(0) is sufficient).

Message was edited by: MS
alex

Community Trekker

Joined:

Jun 23, 2011

It turns out that the above happens where NONE of the lines in the set match the criteria.

So, instead of getting the subset of everything that matches X & Y, because nothing matches X & Y, JMP actually grabs a much bigger subset...(but not the whole set)

Seems very odd.

Any further suggestions?
alex

Community Trekker

Joined:

Jun 23, 2011

turns out that this is addressed in question 5.6 of Jumping into Jmp

Question 5.6:

I am attempting to select some rows, and then create a subset data table. When no rows are selected, all the rows are included in the subset data table. How can I create a subset only if there were rows selected?

Solution 5.6:

Get the number of rows selected using the Get Selected Rows command, and then verify the result is greater than 0 before creating the subset as shown in the following code:

/* Select the desired rows. */
dt << Select Where( :age == 54 & :sex == "F" );

/* Store the number of selected rows in a global variable. */
selRows = N Row( dt << Get Selected Rows );

/* Perform a subset if rows were selected. Otherwise, print
a message in the log. */
If( selRows > 0,
dt << Subset( Output Table Name( "Age 54 Females" ) ),
Print("No rows selected.")
);
anneg

Community Trekker

Joined:

Jun 23, 2011

Hello,

I had the same poblem (but I had the book :-) and now a further one, because I wanted generate a graph using the subset data table, but now I don't have a subset data table.

1. question: can I then create a subset data table with no rows in it - or with a dummy row?

2. question: Is there a easy possibility to check if the subset data exist and then create the graph (more complicated because i generate more than 1 graph with this Subset data table).
pmroz

Super User

Joined:

Jun 23, 2011

I take a different approach. Instead of creating a subset each time I want to plot a different search, I simply exclude data that didn't meet the search criteria. Next I create a plot from the original dataset

dt << select where(:A > 40 & :B == 0) << invert row selection << exclude << clear select;
Hi man, I think tat you should use CART algorithm which is very fun !