Hi
try and run the following code where you open the attached workfile:
close @all
%dir=@runpath
cd %dir'"C:\tvb\articles\labour_services\eviews"
wfopen wfindnc
for !i=570 to 571
%eq=kvartstroll.@line(!i)
if @isobject("test")=1 then
delete test
endif
model test
test.append {%eq}
'generate text file with equations where endogenous variable has already been defined
text problemequations
'TRY TO UNCOMMENT THE FOLLOWING LINE:
scalar a_{!i}_=@wfindnc(kvarts.@endoglist,@trim(test.@endoglist))
'-------------------------------------------------------------------------------------------
if @wfindnc(kvarts.@endoglist,@trim(test.@endoglist)) = 0 then
kvarts.append {%eq}
else
problemequations.append {%eq}
problemequations.append {!i}
endif
next
This creates a blank textfile problemequations. However, if you comment out the scalar a_{!i}_.... line and rerun the program, the textfile problemequations is filled with some text, for some reason. Do you understand what is causing this?
THomas
@wfindnc - bug?
Moderators: EViews Gareth, EViews Moderator
-
- Posts: 540
- Joined: Fri Apr 15, 2011 5:35 am
@wfindnc - bug?
- Attachments
-
- wfindnc.WF1
- (530.82 KiB) Downloaded 205 times
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: @wfindnc - bug?
Looks like it is to do with whether the model has been compiled or not - calling @endoglist before compiling isn't going to work very well.
If you modify your code to be:
it should work as expected.
If you modify your code to be:
Code: Select all
for !i=570 to 571
%eq=kvartstroll.@line(!i)
if @isobject("test")=1 then
delete test
endif
model test
test.append {%eq}
'generate text file with equations where endogenous variable has already been defined
text problemequations
kvarts.update
test.update
'TRY TO UNCOMMENT THE FOLLOWING LINE:
'scalar a_{!i}_=@wfindnc(kvarts.@endoglist,@trim(test.@endoglist))
'-------------------------------------------------------------------------------------------
if @wfindnc(kvarts.@endoglist,@trim(test.@endoglist)) = 0 then
kvarts.append {%eq}
else
problemequations.append {%eq}
problemequations.append {!i}
endif
next
it should work as expected.
Follow us on Twitter @IHSEViews
-
- Posts: 540
- Joined: Fri Apr 15, 2011 5:35 am
Re: @wfindnc - bug?
Excellent, that worked!
thanks
t
thanks
t
Who is online
Users browsing this forum: No registered users and 26 guests