Statalist


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

st: Stopping and Starting a Running Sum


From   [email protected]
To   [email protected]
Subject   st: Stopping and Starting a Running Sum
Date   Tue, 24 Jun 2008 12:17:44 -0700

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/




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