cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP 19 is here! See the new features at jmp.com/new.
  • Register to attend Discovery Summit 2025 Online: Early Users Edition, Sept. 24-25.
Choose Language Hide Translation Bar
katief
Staff (Retired)

Select Where: need to select from current selection in JSL

I would like to select rows from a data set where I have multiple conditions, but instead of using a single select where statement with "and," I want to loop through my conditions one at a time, selecting from the current selection. This is very straightforward in the select where window (use "select from current selection"). How can I do this in JSL?

For example, I have a list of column names cnames = {"Col1", "Col2", "Col3"} and a list of values cspecs = {"a", "b","c} and I want to select the rows from my data table where Col1 = a, Col2 = b, and Col3 = c. I will loop through the items in cnames and tell it to select from the current selection each time. Thanks!

dt<<

select where(as column(cnames)==cspecs)

10 REPLIES 10

Re: Select Where: need to select from current selection in JSL


To select a row without deselecting a previously selected row, combine << Select Where with


<< Select Where and the current selection("extend") argument. This is an alternative to


using an OR statement.


dt << Select Where( age == 14 );


dt << Select Where( sex == "F", current selection("extend"));


msharp,

I am not sure where the syntax you show came from.  The JMP 12.1 Scripting Guide and current online documentation do have the correct text, as shown above. 

Thanks.

Wendy

Wendy

Recommended Articles