Hi,
I have a panel, containing US50, USTER and USA cross-sections. I need to define USA as the sum of US50 and USTER for all variables. I am struggling with how to do this. Thank you
Lenka
panel data: calculate a cross-section as the sum of 2 others
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: panel data: calculate a cross-section as the sum of 2 ot
Probably an easier way, but this will work:
Where you replace "x y z" with the names of your variables, and "cross" with the name of your cross-section ID series.
Code: Select all
group all x y z
sample s1 if cross="USTER" or cross="US50"
for !i=1 to all.@count
smpl @all
%n = all.@seriesname(!i)
series temp = @sumsby({%n}, @obsid, s1)
smpl if cross="USA"
{%n} = temp
d temp
next
smpl @all
Re: panel data: calculate a cross-section as the sum of 2 ot
Thanks,
works perfect.
works perfect.
Who is online
Users browsing this forum: No registered users and 1 guest
