Page 1 of 1

panel data: calculate a cross-section as the sum of 2 others

Posted: Wed Jun 05, 2013 8:35 am
by lenka
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

Re: panel data: calculate a cross-section as the sum of 2 ot

Posted: Wed Jun 05, 2013 8:57 am
by EViews Gareth
Probably an easier way, but this will work:

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
Where you replace "x y z" with the names of your variables, and "cross" with the name of your cross-section ID series.

Re: panel data: calculate a cross-section as the sum of 2 ot

Posted: Fri Jun 07, 2013 3:09 am
by lenka
Thanks,
works perfect.