"Next found outside of loop" Error
Posted: Sun Dec 04, 2016 3:51 pm
Hi all
I'm trying to run a loop of very simple AR(4) regressions for a group (named "pct"), for which I want to save the impulse responses of each series on itself. The responses are to be stored in a matrix titled "ar4". I have written the code below, but whenever I run it there is a "Next found outside of loop" error. Without the next argument it works, but obviously stops at the first variable in the group pct. Any thoughts on what is causing this issue? Thanks in advance
group pct
%v = @wlookup("pct*", "series")
pct.add {%v}
matrix (12,100) ar4
for !i to pct.@count
%name = pct.@seriesname (!i)
var test.ls 1 4 {%name}
test.impulse(12, m ,imp=gen,matbyr=temp) {%name} @ {%name}
colplace(ar4, temp, !i)
d temp
next
stop
I'm trying to run a loop of very simple AR(4) regressions for a group (named "pct"), for which I want to save the impulse responses of each series on itself. The responses are to be stored in a matrix titled "ar4". I have written the code below, but whenever I run it there is a "Next found outside of loop" error. Without the next argument it works, but obviously stops at the first variable in the group pct. Any thoughts on what is causing this issue? Thanks in advance
group pct
%v = @wlookup("pct*", "series")
pct.add {%v}
matrix (12,100) ar4
for !i to pct.@count
%name = pct.@seriesname (!i)
var test.ls 1 4 {%name}
test.impulse(12, m ,imp=gen,matbyr=temp) {%name} @ {%name}
colplace(ar4, temp, !i)
d temp
next
stop