cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
Get the free JMP Student Edition for qualified students and instructors at degree granting institutions.
Choose Language Hide Translation Bar
View Original Published Thread

Syndicated - OutboundJMP Note 575348 - How to select rows that match any value in a list

Overview

The following example demonstrates how you can select rows in a data table that contain any value stored in a JSL list. Lists containing either numeric or character strings can be used.

 

Instructions

In a JMP® session, click the File menu and select New ► Script. Copy the below script and paste it into the script window. To run the sample script, click the Edit menu and select Run Script.

 

/* Open a sample data table. */
dt = Open( "$SAMPLE_DATA\Big Class.jmp" );

/* Create a list of ages. */
myList = {9, 12, 15, 17, 18};

/* Select all rows which have an age that is in the list. */
dt << Select Where( Contains( myList, :age ) );

Wait( 2 );           // For demonstration purposes
dt << Clear Select;  // For demonstration purposes

/* Create a list of student names. */
myStudents = {"HENRY", "ROBERT", "BARBARA", "SALLY", "MARION"};

/* Select all rows which have any of the names in the list. */
dt << Select Where( Contains( myStudents, :name ) );

 

Additional Documentation

More information about the JMP Scripting Language can be found in the JMP Scripting Guide. You can access the guide from within JMP by clicking on the Help menu and select JMP Help.  From the online Table of Contents, choose Scripting Guide.

 

 

[Previously JMP Note 49560]

Details
Operating System
macOS Windows
Products JMP JMP Pro

Recommended Articles

No recommendations found