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]
Re: st: How to sum two whole rows by date and time
From
Nick Cox <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: How to sum two whole rows by date and time
Date
Wed, 3 Aug 2011 18:07:36 +0100
This does sound like
. collapse ... , by(date time)
and -date time- must not appear as part of what is here represented
by ... -as you report.
Nick
On 3 Aug 2011, at 17:39, Beatrice Crozza <[email protected]>
wrote:
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.
*
* 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/