Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Difference between dates


From   "Jose Passos" <[email protected]>
To   <[email protected]>
Subject   st: Difference between dates
Date   Mon, 25 Jul 2005 14:55:09 +0100

Hi all,
Suppose I had data like this:

year month day x1 x2
1979   8   23   0  1
1980   5   23   1  1
1980   6    6   0  0
1981   1    2   1  0
1981   2   20   1  1
...

The data set are ordered by day, month, year, and I want to compute the
difference in days between adjacente rows (nday), so it looks like this:

year month day x1 x2 nday
1979   8   23   0  1   .
1980   5   23   1  1  274
1980   6    6   0  0   14
1981   1    2   1  0  240
1981   2   20   1  1   19
...

Thanks in advance
jose

*
*   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