cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
poulravn
Level IV

How to select rows based on multiple criteria?

Hi,

I am writing a script to Subset a data table. Following the scripting guids' coding example I can select according to a criterium:

for each row(Selected(Rowstate())=(name=="KATIE"));

How can I generalize this to select both KATIE and LOUISE?

This does not work:

for each row(Selected(Rowstate())=(name=="KATIE","LOUISE"));

So what is the syntax for this?

Regards

Poul

   

10 REPLIES 10
pmroz
Super User

Re: How to select rows based on multiple criteria?

This syntax might be a little more readable.  You can use the vertical bar for OR, and the ampersand for AND:

dt = open("$sample_data\Big Class.jmp");

dt << select where((contains(:name, "ATIE") | contains(:name, "OBER"))

                                      & contains(:sex, "F"));

Recommended Articles