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: RE: How to sum two whole rows by date and time
From
"Cohen, Elan" <[email protected]>
To
statalist <[email protected]>
Subject
st: RE: How to sum two whole rows by date and time
Date
Wed, 3 Aug 2011 17:10:24 +0000
collapse (sum) x y d1 d2 d3 dup, by(date time)
> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of Beatrice Crozza
> Sent: Wednesday, August 03, 2011 12:40
> To: statalist
> Subject: st: How to sum two whole rows by date and time
>
> Dear All,
>
> maybe it is an easy problem to solve, but I cannot find a way to sort it out!
>
> I would like to sum the entries of two rows:
>
> date time x y d1 d2 d3 dup
> 23/01/2008 9:05 99.8 1 . . 1
> 23/01/2008 9:05 . 5 . 1 1 2
>
> i would like to sum by date and time, in order to have:
>
> date time x y d1 d2 d3 dup
> 23/01/2008 9:05 99.8 5 1 1 1 3
>
>
> It is not always the case that, for example, one row has the price, in
> other words there is not regularity, otherwise I could have used a
> time operator to replace the row with the previous one.
>
> I also tried with collapse (sum) but i receive the error message that
> a variable cannot be both target and by() and I haven't found a
> command similar to egen rowtotal for summing columns.
>
> Thank you very much for any help.
>
> Bea
> *
> * 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/
*
* 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/