Code: Select all
%series_list = "econ1 econ2 econ3"
For %portfolio port1 port2 port3
For %model test1 test2 test3 test4
%temp= "%" + %portfolio + "_" + %model
wfopen {%temp}
%current_wf1=@wfname
For %series {%series_list}
Pageselect New_Port
if @isobject(%series)=1 then
copy(overwrite) {%current_wf1}::New_Port\{%series} {%wf1_name}::Economics\{%series}_{%portfolio}_{%model}
else
statusline %series does not exist in workfile %temp
endif
next
wfuse {%current_wf1}
wfclose
next
next
The problem I'm having is that when the code runs the final iteration of the 3rd loop, it tries to run it again, replacing the control variable %series with econ3 and so the program falls over.
I've tried resetting %series="" at the end of the loop but that causes a similar error.
Hope I've explained my problem well. Any ideas??
