Building on Gareth's example, a self-referential expression lets you maintain the previous dummy value in the case that the return is constant.
Code: Select all
series dummy = @recode(y>y(-1),1,@recode(y<y(-1),0,@nan(dummy(-1),1)))
Code: Select all
series dummy = @recode(y>y(-1),1,@recode(y<y(-1),0,@nan(dummy(-1),1)))
Code: Select all
net = x - @pmax(x(-1), @pmax(x(-2), @pmax(x(-3), ...)))
Code: Select all
VEC2 = @capplyranks(VEC2, @seq(VEC2.@rows, -1, VEC2.@rows))