Here is a good start on what you want. You should be able to expand on this to meet and discrepancies in what your final requirements are.
If you haven't taken the time to read the Scripting Guide available under JMP Help, I strongly suggest that you do that. Also, make sure your study the example below, so you understand the logic and the specifics of the functions and statements.
names default to here(1);
// Open Data Table: Dataset.jmp
// → Data Table( "Dataset.jmp" )
dt = Open( "$Downloads/Dataset.jmp" );
// Open Data Table: Dictionary.jmp
// → Data Table( "Dictionary.jmp" )
dtDict = Open( "$Downloads/Dictionary.jmp" );
/*// Subset data table
// → Data Table( "Subset of Dictionary" )
Data Table( "Dictionary.jmp" ) << Clear Select << Select Rows( Index( 1, 10 ) ) <<
Subset( Selected Rows( 1 ), Selected columns only( 0 ) );
// Subset data table
// → Data Table( "Subset of Dictionary 2" )
Data Table( "Dictionary.jmp" ) << Clear Select << Select Rows( Index( 11, 14 ) ) <<
Subset( Selected Rows( 1 ), Selected columns only( 0 ) );*/
// Change column modeling type: Values
Data Table( "Dictionary" ):Values << Set Modeling Type( "Continuous" );
// Create a new dictionary data table for each level of the Column column
dtDictList = dtDict << Subset(
By( :Column ),
All rows,
Selected columns( 0 ),
Selected rows( 0 )
);
/*// Change column info: Values
Data Table( "Dictionary.jmp" ):Values << Data Type( Numeric ) <<
Set Field Width( 12 );*/
// Clear row selection
//Data Table( "Dataset.jmp" ) << Clear Select;
dt << Clear Column Selection();
// Change column modeling type: ETHNICITY
Data Table( "Dataset.jmp" ):ETHNICITY << Set Modeling Type( "Continuous" );
// Change column modeling type: ETHCAT
Data Table( "Dataset.jmp" ):ETHCAT << Set Modeling Type( "Continuous" );
/*// Change column modeling type: Values
Data Table( "Subset of Dictionary 2" ):Values << Set Modeling Type( "Continuous" );
// Change column modeling type: Values
Data Table( "Dictionary.jmp" ):Values << Set Modeling Type( "Continuous" );*/
For Each( {thedt, index}, dtDictList,
// Get the dataset column to join with
joinColumn = Word( 3, Char( thedt ), "=\!"" );
// Join data tables
// → Data Table( "untitled 1925" )
newDT = dt << Join(
With( thedt ),
Merge Same Name Columns,
Match Flag( 0 ),
By Matching Columns( Column( joinColumn ) = :Values ),
Drop multiples( 0, 0 ),
Include Nonmatches( 1, 0 ),
Preserve main table order( 1 ),
Output Table( "Join of Dataset with Column=ETHCAT" )
);
NewDt:Labels << set name( joinColumn || " Labels" );
NewDt:Values << set name( joinColumn || " Values" );
If( index > 1,
Close( dt, nosave )
);
dt = newDT;
);
Jim