- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
How can select data based on the value of another data table?
For example, using the "Big class.jMP "data, select the number of rows whose "age" corresponds to the value of another table.
Thanks!
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How can select data based on the value of another data table?
Here is a simple example to do the selections you want
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );
// Create the config table
dtCon = New Table( "Config", New Column( "Col", values( {13, 15} ) ) );
// Select the data based upon the values in the Config table
dt << clear select;
For( i = 1, i <= N Rows( dtCon ), i++,
dt << select where( :age == dtCon:Col[i], current selection( "extend" ) )
);
Jim
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How can select data based on the value of another data table?
Here is a simple example to do the selections you want
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );
// Create the config table
dtCon = New Table( "Config", New Column( "Col", values( {13, 15} ) ) );
// Select the data based upon the values in the Config table
dt << clear select;
For( i = 1, i <= N Rows( dtCon ), i++,
dt << select where( :age == dtCon:Col[i], current selection( "extend" ) )
);
Jim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How can select data based on the value of another data table?
Thank Jim!
Again, There going to use the loop.
Again, There going to use the loop.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How can select data based on the value of another data table?
Created:
Jun 23, 2020 02:48 AM
| Last Modified: Jun 23, 2020 2:28 AM
(3096 views)
| Posted in reply to message from lala 06-22-2020
d1 = Current Data Table();
d2 = Open( "$SAMPLE_DATA/Big Class.jmp" );
d2 << Update( With( d1 ), Match Columns( :age = :age ), Add Columns from Update table( :col ) );
d2 << Select Where( :col > 0 );
d3 = d2 << Subset( Output Table( "test" ), Selected Rows( 1 ), selected columns( 0 ) );
That's all I can do.