Hi,
I want to create a series that sums other series in a workfile and I am unsure about the syntax:
The code underneath does not work but I believe illustrates what I am trying to do:
For %latam arg bra chl col ecu per ury ven
For %abovline curr good serv fact tran
series lat8_{%abovline}_ltm= lat8_{%abovline}_ltm+{%latam}_{%abovline}_ltm
next
next
So that I obtain:
lat8_curr_ltm=arg_curr_ltm+bra_curr_ltm+chl_curr_ltm+...
Any suggestions will be appreciated.
Regards,
Javier
Recursive sum of series
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Recursive sum of series
A quick look indicates that your code should work, although, of course, you'd have to set the output series equal to zero before the loop starts.
Re: Recursive sum of series
That was it! Thanks.
Javier
Javier
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: Recursive sum of series
Slightly off-topic note for instructional purposes. A slightly different approach uses the @rsum
This may be useful if you wish to do something slightly more complicated like computing the means or variances across the series.
Code: Select all
For %aboveline curr good serv fact tran
%names = ""
For %latam arg bra chl col ecu per ury ven
%names = %names + " " + %latam +"_" + %aboveline + "_ltm"
next
group {%aboveline} {%names}
series {%aboveline}_sum = @rsum({%aboveline})
delete {%aboveline}
nextRe: Recursive sum of series
Thanks a lot. That code is really useful.
Regards,
Javier
Regards,
Javier
Who is online
Users browsing this forum: No registered users and 2 guests
