Floating points in @elem

For questions regarding programming in the EViews programming language.

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

nvellodi
Posts: 7
Joined: Tue Aug 02, 2011 9:57 pm

Floating points in @elem

Postby nvellodi » Tue Aug 02, 2011 10:11 pm

I am writing a program that requires estimation over a number of different sample periods. I have successfully coded this using a series of nested while loops, with code such as:

smpl 1998:1 200!i:!j

where !i and !j are the floats I'm using to index the while loops. This works. However, when I try and call an element from a series using a similar expression:

scalar forerror = @elem(pi, "200!i:!j")

eviews doesn't like this, and says I've entered an illegal date. Am I doing something stupid here, or is it just that the @elem value doesn't allow floating points when one calls a date? I can work around this, by calculating the numerical indice of the element, but it seems strange.

Thanks,

Nikhil

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

Floating points in @elem

Postby EViews Gareth » Tue Aug 02, 2011 10:59 pm

You can't have ! variables inside quotes. Try:

Code: Select all

%s = "200" + @str(!i) + ":" + @str(!j) scalar forerror = @elem(pi, %s)

nvellodi
Posts: 7
Joined: Tue Aug 02, 2011 9:57 pm

Re: Floating points in @elem

Postby nvellodi » Wed Aug 03, 2011 4:55 pm

Brilliant, nice trick. Also, the promptness of your response was startling. Many thanks.
Nikhil


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests