From: "Nick Cox" <[email protected]>
Reply-To: [email protected]
To: <[email protected]>
Subject: st: RE: Cumulative Sum by groups
Date: Fri, 22 Apr 2005 15:18:32 +0100
bysort ID (year) : gen cusum = _N - _n + 1
Nick
[email protected]
Alexander Nervedi
> I am looking to implement a group level cumulative sum that
> starts counting
> backwards. Any suggestions on how to go about this would be
> really useful
>
> data example:
> ID year num cusum
> 1 90 1 2
> 1 91 1 1
> 2 90 1 4
> 2 91 1 3
> 2 92 1 2
> 2 93 1 1
> 3 90 1 1
> 4 90 1 2
> 4 90 1 1
> ...
>
> I have variables ID year and num, and am trying to create cusum
*
* 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/
_________________________________________________________________