The World Statistics Day celebration continues here in the Community. We all need reliable data for sound decision making. Do you have a data source that you trust most? Head over to Discussions to tell us about it.
Choose Language Hide Translation Bar
Highlighted
aandw
Level II

Join Data Table to existing Data Table with No Output Table?

I would like to join a series of similarly structured data tables to an existing "master" data table.

I do not want to create an output table after every join command is complete.

I want the subsequent data tables to continue joining (and compiling) onto the master data table.

A similar command is "Append to first table" under dt << concatenate( data table ( ...

e.x

/* Join (merge)  scenarios */

dt = Open("H:\original.jmp");

dt << Set Name("MASTER");

// Open Subsequent files to join onto Master

dt = Open("H:\scenario1.jmp");

Data Table( "MASTER" ) << Join(

  With( Data Table( "scenario1" ) ),

  Merge Same Name Columns,

  By Matching Columns(

  :Year = :Year,

  :Month = :Month,

  :Route = :Route

  ),

  Drop multiples( 1, 0 ),

  Name( "Include non-matches" )(1, 0),

  Preserve main table order( 1 ),

// No Output Table Command Needed HERE

// Output Table( "name"),

  );

1 REPLY 1
Highlighted
aandw
Level II

Re: Join Data Table to existing Data Table with No Output Table?

Sorry, simple function.

Use UPDATE command.

// Update Data Table by Merging on Same Name Columns

// New Columns merge onto existing data table.

Data Table( "MASTER" ) << Update(

  With( Data Table( "scenario1" ) ),

  Merge Same Name Columns,

  By Matching Columns(

  :Year = :Year,

  :Month = :Month,

  :Route = :Route

  ),

  Drop multiples( 1, 0 ),

  Name( "Include non-matches" )(1, 0),

  Preserve main table order( 1 ),

  //No Output,

  );

Article Labels

    There are no labels assigned to this post.