Thank you for replying Matt.

When I try the following it generates an error:

NA found in matrix in "IF @LAST(RESEQ_XX001) >

RESEQ_XX001 + @STDERRS(RESEQ_XX001) OR

@LAST(RESEQ_XX001) < RESEQ_XX001 -

@STDERRS(RESEQ_XX001) THEN"

I am basically trying to put a dummy if the last data point is outside of the residuals' one standard error bands

Code: Select all

`%eqlist=@wlookup("*","equation") 'make a list of all equations in workfile`

for !i=1 to @wcount(%eqlist) 'cycle through the list one at a time

%eq = @word(%eqlist,!i) 'current equation name

%estcmd = {%eq}.@command 'current equation's estimation command

%eqsmpl = {%eq}.@smpl

smpl {%eqsmpl}

'estimate ecuation keeping each estimation sample

{%eq}.{%estcmd} 're-estimate current equation with its command

{%eq}.makeresids res{%eq} 'generate residuals' series

if @last(res{%eq}) > res{%eq} + @stderrs(res{%eq}) or @last(res{%eq}) < res{%eq} - @stderrs(res{%eq}) then '

%estcmd = {%eq}.@command + "@event("res{%eq}.@last")"

endif

next

smpl @all 'reset sample