Hello,
I'm trying to write a function that refers to a certain row of a column and trying to make it dynamic where I can run it on any column name. Using the Big Class table as sample, I'm trying to run the calculation on the height column but I couldn't get it working unless its hardcoded in the function. Also the lag function doesn't seem to work within a function.
This is the script that I have.
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
Row() = 4;
ii = 4;
Test = Function({tag},
Y = tag[ii] - tag[ii-1]; // this doesn't work
//Y = height[ii] - height[ii-1]; this works
X = lag(tag,1); // this doesn't work
//X = lag(height,1); this works
);
Test(height)
Thanks in advance