Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: summing across observations for given id and date

From   Anton Granik <>
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:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index