I would like to create an associative array from column values. I am curious if anyone in the JMP community has a clever solution. I am using JMP10. An example is below.
// For the following data table:
example = New Table( "Example Data", Add Rows( 27 ), New Column( "Lot", Character, Nominal, Set Values(
{"A", "A", "A", "A", "A", "A", "A", "A", "A", "B", "B", "B", "B", "B", "B", "B", "B", "B", "C", "C", "C", "C", "C", "C", "C", "C", "C"}
) ), New Column( "Test", Character, Nominal, Set Values(
{"Test1", "Test1", "Test1", "Test2", "Test2", "Test2", "Test3", "Test3", "Test3", "Test1", "Test1", "Test1", "Test2", "Test2", "Test2",
"Test3", "Test3", "Test3", "Test1", "Test1", "Test1", "Test2", "Test2", "Test2", "Test3", "Test3", "Test3"}
) ), New Column( "Parameter", Character, Nominal, Set Values(
{"Param1", "Param2", "Param3", "Param1", "Param2", "Param3", "Param1", "Param2", "Param3", "Param1", "Param2", "Param3", "Param1",
"Param2", "Param3", "Param1", "Param2", "Param3", "Param1", "Param2", "Param3", "Param1", "Param2", "Param3", "Param1", "Param2",
"Param3"} ) ), New Column( "Yield", Numeric, Continuous, Format( "", 16 ),
Set Values( [1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0] )
), New Column( "Defect Code", Character, Nominal, Formula( If( :Yield == 0, :Test || "_" || :Parameter ) ) ) );
// I would like to create an associative array with key = Lot, and values = Defect Codes. Please see example below.
// What is the best way to script this?
// As a bonus, is it possible to create an associative array with multiple levels (IE: Lot => Test => Parameter => Defect Code)?
Defects = Associative Array( example:Lot );
Defects["A"] = {"Test1_Param3", "Test2_Param2", "Test2_Param3", "Test3_Param2"};
Defects["B"] = {"Test1_Param1", "Test1_Param2", "Test1_Param3", "Test2_Param2", "Test3_Param2", "Test3_Param3"};
Defects["C"] = {"Test1_Param2", "Test1_Param3", "Test2_Param3", "Test3_Param3"};
// Thanks for the help!