"for" to compute series backwards

For questions regarding programming in the EViews programming language.

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

fmramos
Posts: 116
Joined: Fri Sep 19, 2008 7:30 am
Location: Sao Paulo / Brazil

"for" to compute series backwards

Postby fmramos » Wed Apr 28, 2010 8:04 am

Hi all!

I'm not used to loop routines. For the bellow task I usually compute with Excel easily.

I'd like to compute a series like:

y=y(1)/(1+dy/100)

y ~level; dy~an old series growth rate.

The original sample is 1991m1 to 2010m2. I have old growth rates backwards to 1901m01.

Does someone can help me?

Tks in advance,

Fabio

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

Re: "for" to compute series backwards

Postby EViews Gareth » Wed Apr 28, 2010 8:42 am

Something like this:

Code: Select all

!numofmonths = @datediff(@dateval("1990m12"), @dateval("1901m1"), "mm") for !i=!numofmonths to 0 step -1 smpl @first+!i @first+!i y = y(1)/(1+dy/100) next smpl @all series test = y(-1)*(1+dy(-1)/100)
If all went well, test should equal y.

fmramos
Posts: 116
Joined: Fri Sep 19, 2008 7:30 am
Location: Sao Paulo / Brazil

Re: "for" to compute series backwards

Postby fmramos » Wed Apr 28, 2010 11:55 am

Tks Gareth, You're the man.

It worked with a little change ("+!i" by "-!i") cause I'd like to compute old data y by dy (1901/1990) in function of new data y (1991/2010).

Fabio


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest