Page 1 of 1

Compounding

Posted: Mon Feb 21, 2011 4:23 am
by javiersan
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

Re: Compounding

Posted: Mon Feb 21, 2011 6:21 pm
by EViews Gareth

Code: Select all

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

Re: Compounding

Posted: Tue Feb 22, 2011 9:43 am
by javiersan
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