- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Rowwise conditonal calculation
I have a table of data with three columns of process data and one column with quality data. I would like to calculate a value (in new columns -each for one of the process parameters) if the process value between two rows are changing.
So first of all I need JMP to look at each row and then determine whether each of the process variables are changed (if function??).
If changes have occurred then calculate (quality(1)-quality(2))/(process value(1)-process value(2))
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Rowwise conditonal calculation
You can calculate difference between rows using Dif() or Lag().
Names Default To Here(1);
dt = New Table("Untitled 2",
Add Rows(3),
Compress File When Saved(1),
New Column("P", Numeric, "Continuous", Format("Best", 12), Set Values([1, 1, 2])),
New Column("Q", Numeric, "Continuous", Format("Best", 12), Set Values([3, 3, 6]))
);
dt << New Column("", Numeric, Continuous, Formula(
difval1 = Dif(:P);
difval2 = Dif(:Q);
If(difval1 & difval2,
difval2 / difval1;
,
.
);
));
You can explore subexpression values from formula editor if needed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Rowwise conditonal calculation
You can calculate difference between rows using Dif() or Lag().
Names Default To Here(1);
dt = New Table("Untitled 2",
Add Rows(3),
Compress File When Saved(1),
New Column("P", Numeric, "Continuous", Format("Best", 12), Set Values([1, 1, 2])),
New Column("Q", Numeric, "Continuous", Format("Best", 12), Set Values([3, 3, 6]))
);
dt << New Column("", Numeric, Continuous, Formula(
difval1 = Dif(:P);
difval2 = Dif(:Q);
If(difval1 & difval2,
difval2 / difval1;
,
.
);
));
You can explore subexpression values from formula editor if needed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Rowwise conditonal calculation
Hi.
Thank you for your quick solution. Ìn the script you create a dt. I have already create a dataset can I refer to this as well?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Rowwise conditonal calculation
You can. How you should do it, depends where you get the data table. If you open it from somewhere using Open() is the way to go (see Scripting Index (fround from JMP Help menu) and Scripting Guide for more information regarding scripting).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Rowwise conditonal calculation
Also you can directly create the formula to your data table, no need to use script editor
difval1 = Dif(:P);
difval2 = Dif(:Q);
If(difval1 & difval2,
difval2 / difval1;
,
.
);