Aggregating Cross-Sections in Pools

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator

pmgm
Posts: 2
Joined: Fri Aug 06, 2010 9:16 am

Aggregating Cross-Sections in Pools

Postby pmgm » Mon Aug 09, 2010 2:06 pm

Dear all,

I would like to aggregate cross-sections (e.g. countries into regions) in a pooled workfile. So far I have got (e.g. for Asia):

for %v GDP POP INF NER EXP IMP FDI
series {%v}_Asia = 0
for %c BN FJ ID KH KP LA MM MN MY PG
{%v}_Asia = {%v}_Asia + {%v}_{%c}
next
next

Not the tidiest of codes, as I need to repeat this for all regions (about 20). Could anyone suggest a way to include the regions in the loop?

Many thanks.

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

Re: Aggregating Cross-Sections in Pools

Postby EViews Gareth » Mon Aug 09, 2010 2:20 pm

Like this ?:

Code: Select all

for %r asia europe americas
for %v GDP POP INF NER EXP IMP FDI
series {%v}_{%r} = 0
for %c BN FJ ID KH KP LA MM MN MY PG
{%v}_{%r} = {%v}_{%r} + {%v}_{%c}
next
next
next
Follow us on Twitter @IHSEViews

pmgm
Posts: 2
Joined: Fri Aug 06, 2010 9:16 am

Re: Aggregating Cross-Sections in Pools

Postby pmgm » Tue Aug 10, 2010 1:25 am

Thank you for your quick reply, Gareth. Unfortunately that would not work, since each region has different members. Say we have:

Asia = BN FJ ID KH KP LA MM MN MY PG
Americas = CR CU DO GT JM MX NI SR TT
Africa = AO BF CV TD KM ET GA GN GW KE
Europe = FR DE LU NL GR IS IT
etc…

The code suggested would create regional variables with the same values (_Asia = _Europe) since they would be based on the same group members (in this case, Asian countries), i.e. %c.

I have created pool objects (one for each region to identify their members), but I am not sure how to insert this information in the loop.

Thank you again.

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

Re: Aggregating Cross-Sections in Pools

Postby EViews Gareth » Tue Aug 10, 2010 8:05 am

There is probably a clever way using pools, but I'm not a pool fan and never use them as much as I should.

You could use string lists though. This code isn't tested, but the idea should work even if there is a mistake:

Code: Select all

%Asia = "BN FJ ID KH KP LA MM MN MY PG"
%Americas = "CR CU DO GT JM MX NI SR TT"
%Africa = "AO BF CV TD KM ET GA GN GW KE"

for %r asia americas africa
for %v GDP POP INF NER EXP IMP FDI
series {%v}_{%r} = 0
%reglist = %{%r}
for !i = 1 to @wcount(%reglist)
%c = @word(%reglist,!i)
{%v}_{%r} = {%v}_{%r} + {%v}_{%c}
next
next
next
next
next
next
Follow us on Twitter @IHSEViews


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 8 guests