sample/string error in subroutine

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

amrsherif
Posts: 99
Joined: Mon Jul 23, 2018 4:34 pm

sample/string error in subroutine

Postby amrsherif » Mon Aug 12, 2019 10:02 am

One of our subroutines is no longer working (although we've made no changes to the code). I've attached the error message.
Specifically, the error is in this line:

series s1adj=s1*@elem(s2, %firstdate2)/@elem(s1, %firstdate2)

Both %firstdate2 and %firstdate2 are defined properly, and the line "smpl %firstdate1 %firstdate2" works as expected. The command in the attached error message also works fine in the command line.

Any thoughts?
Attachments
Capture.PNG
Capture.PNG (17.85 KiB) Viewed 3125 times

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

Re: sample/string error in subroutine

Postby EViews Gareth » Mon Aug 12, 2019 10:09 am

Hard to say without more context. A simple example seems to work:

Code: Select all

create m 1990 2000
series s1=nrnd
series s2=nrnd
call foo("1991m01", "1991m02")


subroutine foo(string %firstdate1, string %firstdate2)
   series s1adj = s1*@elem(s2, %firstdate2)/@elem(s1, %firstdate2)
endsub
Follow us on Twitter @IHSEViews

amrsherif
Posts: 99
Joined: Mon Jul 23, 2018 4:34 pm

Re: sample/string error in subroutine

Postby amrsherif » Mon Aug 12, 2019 10:17 am

Thanks for the quick response. The example posted gives me the same error. I managed to work around it by splitting the line into two:

!tempscalar=@elem(s2, %firstdate2)/@elem(s1, %firstdate2)
series s1adj=s1*!tempscalar

Old Code
'series s1adj=s1*@elem(s2, %firstdate2)/@elem(s1, %firstdate2)

I'm using the July 19 build by the way, not sure if this is related.


''''''''''''''''''UPDATE''''''''''''''''''
Updating EViews with the new patch fixed the issue


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 26 guests