Bookmark and Share

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: summing across observations for given id and date


From   Anton Granik <[email protected]>
To   [email protected]
Subject   st: summing across observations for given id and date
Date   Sat, 4 Dec 2010 18:03:15 +0100

I have the following panel data set where dates sometimes repeat:

id  date  x1  x2

1   t=1   1    12
1   t=2   1     9
1   t=2   2    11
1   t=5   1     7


I would like to do the following:
1. For every individual (id) I need to add all values of x2
corresponding to the same date, i.e. in the example above I would want
to get rid of lines 2 and 3 and replace them with

id   date   x1  x2
1    t=2     3   20

Any easy way to do that? Thanks in advance.

---------------------
Anton I. Granik

---------------------
Anton I. Granik

*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index