@wfindnc - bug?

For notifying us of what you believe are bugs or errors in EViews.
Please ensure your copy of EViews is up-to-date before posting.

Moderators: EViews Gareth, EViews Moderator

tvonbrasch
Posts: 540
Joined: Fri Apr 15, 2011 5:35 am

@wfindnc - bug?

Postby tvonbrasch » Thu Dec 17, 2015 2:47 am

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
Attachments
wfindnc.WF1
(530.82 KiB) Downloaded 205 times

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13312
Joined: Tue Sep 16, 2008 5:38 pm

Re: @wfindnc - bug?

Postby EViews Gareth » Thu Dec 17, 2015 10:32 am

We shall investigate.
Follow us on Twitter @IHSEViews

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13312
Joined: Tue Sep 16, 2008 5:38 pm

Re: @wfindnc - bug?

Postby EViews Gareth » Thu Dec 17, 2015 11:26 am

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:

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

tvonbrasch
Posts: 540
Joined: Fri Apr 15, 2011 5:35 am

Re: @wfindnc - bug?

Postby tvonbrasch » Fri Dec 18, 2015 6:21 am

Excellent, that worked!

thanks
t


Return to “Bug Reports”

Who is online

Users browsing this forum: Google [Bot] and 10 guests