Here is one way to do it
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
ca = "A";
New Column( ca, set each value( :height / Lag( :height, 5 ) > 1.1 ) );
ca = "SumA";
New Column( ca, set each value( Sum( :A[Index( Row() - 9, Row() )] ) ) );
ca = "Sum1";
New Column( ca,
set each value(
As Constant(
a = [];
For( i = 1, i <= N Rows( Current Data Table() ), i++,
If( i > 5,
a = a || ((:height[i] / :height[i - 5]) > 1.1),
a = a || .
)
);
);
If( Row() > 5,
Sum( A[Index( Max(6,Row() - 9), Row() )], . )
);
)
);
Here is another way
ca = "Sum1a";
New Column( ca,
set each value(
If( Row() <= 5,
val = .,
theRows = Index( Max( 6, Row() - 9 ), Row() );
val = .;
For Each( {calc}, theRows,
val = Sum( val, (:height[calc] / :height[calc - 5]) > 1.1 )
);
);
val;
)
);
Jim