Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: row wise summation in panel data for particular IDs
From
[email protected]
To
[email protected]
Subject
st: row wise summation in panel data for particular IDs
Date
Sun, 09 Jan 2011 16:57:54 -0500
Dear all,
I am required to take into account the changes in boundary of cities
over a period so that all the information can be attributed to the
parent cities at the start of the time period. I have already tried
but could not find a similar case in previous threads.
This is a panel data , say with id, year and vars. I need to merge
(sum or weighted sum) two particular ids completely to form a new one.
For instance, I have:
id year var1 var2 var3
1 2001 40
1 2002 50
1 2003 60
2 2001 400
2 2002 500
2 2003 600
3 2001 4000
3 2002 5000
3 2003 6000
desired Output will be like (summing up corresponding values of var1
in given year for id 1 and 2, keeping 3 intact and having the results
in a newly created id, say 4).
id year var1 var2 var3
1 2001 40
1 2002 50
1 2003 60
2 2001 400
2 2002 500
2 2003 600
3 2001 4000
3 2002 5000
3 2003 6000
4 2001 440
4 2002 550
4 2003 660
Any help will be appreciated.
Thanks.
Prabhat
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/