For the latest version of JMP Help, visit JMP.com/help.


Publication date: 06/21/2023

Compare Data Tables

JMP can compare two open data tables and report the differences between data, scripts, table variables, column names, column properties, and column attributes. To compare data tables using JSL, follow this example:

obj = dt << Compare Data Tables(
Compare With( Data Table ( "Data Table Name" ) );

For example, to compare the data tables Students1.jmp and Students2.jmp, proceed as follows:

dt = Open( "$SAMPLE_DATA/Students1.jmp" );
dt2 = Open( "$SAMPLE_DATA/Students2.jmp" );
obj = dt << Compare Data Tables( Compare With( Data Table( "Students2" ) ) );

To view the difference summary matrix for the comparison results, use this function:

mtx = ( obj << Get Difference Summary Matrix );

The resulting matrix appears in the log window:

[-1 1 2 2,

-1 2 4 3,

-1 1 7 4,

1 3 8 4,

1 1 10 9,

0 1 11 11,

-1 1 14 14,

-1 1 16 15,

1 1 18 16,

-1 1 19 18,

0 1 22 20,

0 1 26 24,

1 1 29 27,

1 1 34 33]

In the comparison summary matrix in the example, the first column represents the action performed on a column: -1 for a Delete, 0 for a Replace, and 1 for an Add. The second column represents the number of rows affected by the action. The third and fourth columns represent the row numbers affected in the two data tables in their respective order (Students1.jmp, Students2.jmp).

Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).