[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: Stopping and Starting a Running Sum
I would like to create a running sum (eg SumHours) that restarts
whenever there is a change in ID or the difference between the current
date and previous day's date is >1.
ID Hours Date SumHours
1 2 16437 2
1 3 16438 5
1 2 16440 2
1 2 16441 4
2 4 16437 4
2 3 16440 3
2 4 16441 7
2 2 16442 9
2 2 16443 11
Any ideas?
Thank you.
*
* 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/