Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: RE: Adding cumulatively


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: Adding cumulatively
Date   Thu, 15 May 2008 18:08:28 +0100

Not surprising, until one reads the help. Having it that way round means
that the totals are one step away. 

bysort id (year) : gen cumvar1 = sum(var1)
by id: gen sumvar1 = cumvar1[_N] 

If I had been present at the creation, I would have made a case for a
name like -cusum()-. But I turned up too late and a few thousand miles
(km) away. 

Nick 

Rijo John

Thanks. For some reason I though sum function will produce the same
total sum against all values.

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index