Compounding

For questions regarding programming in the EViews programming language.

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

javiersan
Posts: 184
Joined: Mon Jan 19, 2009 8:18 am

Compounding

Postby javiersan » Mon Feb 21, 2011 4:23 am

Hello,

Say I want to compound annually a series like the CPI index at a rate of 3%p.a. I can't come up with anything better than the following code:

Code: Select all

create a 2010 2030 series inf=na inf(1)=100 !infl_rt=0.03 %lastvaldt=@otod(@ilast(inf)) !lastval=@last(inf) smpl {%lastvaldt} @last series inf=!lastval*(1+!infl_rt)^@trend smpl @all
Is there any more compact way of achieving the same result?

Thanks,

Javier

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

Re: Compounding

Postby EViews Gareth » Mon Feb 21, 2011 6:21 pm

Code: Select all

inf = 100 smpl @first+1 @last inf = inf(-1)*1.03

javiersan
Posts: 184
Joined: Mon Jan 19, 2009 8:18 am

Re: Compounding

Postby javiersan » Tue Feb 22, 2011 9:43 am

Ah! inf=inf(-1)*1.03 did not work because I only had 1 non-na data point so the trick is then to fill the series from the beginning.

Thanks,

Javier


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests