I have two data tables in my project and am trying to write a script that would like to create a third data table which is the values in table #2 subtracted from table #1. Categorical variable columns and column names are the same in both tables and would need to be the same in table #3. I'm using JMP pro 16.
I don't really use projects, but this can give you one idea for the script using Data table subscripting (it assumes both have same amount of rows and columns)
Names Default To Here(1);
dt = New Table("Untitled 2",
Add Rows(3),
Compress File When Saved(1),
New Column("Column 1", Character, "Nominal", Set Values({"A", "B", "C"})),
New Column("Column 2", Numeric, "Continuous", Format("Best", 12), Set Values([1, 2, 3])),
New Column("Column 3", Numeric, "Continuous", Format("Best", 12), Set Values([4, 6, 8]))
);
dt2 = New Table("Untitled 2",
Add Rows(3),
Compress File When Saved(1),
New Column("Column 1", Character, "Nominal", Set Values({"A", "B", "C"})),
New Column("Column 2", Numeric, "Continuous", Format("Best", 12), Set Values([2, 3, 4])),
New Column("Column 3", Numeric, "Continuous", Format("Best", 12), Set Values([8, 12, 18]))
);
dt3 = dt2 << Subset(All Rows, Seleted Columns(0));
cont_cols = dt2 << Get Column Names(Continuous, "String");
dt3[0, cont_cols] = dt3[0, cont_cols] - dt[0, cont_cols];Thanks! This worked well!