Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: date subtraction


From   dr kardos laszlo <[email protected]>
To   [email protected]
Subject   Re: st: date subtraction
Date   Thu, 18 Dec 2008 11:12:07 +0100

on second thought, your opdate[83] being far in the future is my guess.

dr kardos laszlo wrote:
moleps, looks like your fudate and pfudate in obs 83 are about two centuries behind. check out the values of those observations without date formatting, you will see negative integers if i'm right. generally, it is a good idea to use 4-digit years when formatting dates.

laszlo

moleps islon wrote:
IN generating the timevariabel for a cox model I get the follwing.
Everything is perfect, except id 83. Any idea why??

gen futime=fudate-opdate
gen pfutime=pfudate-opdate
gen coxtime=pfutime if pfutime>futime &pfutime<.
replace coxtime=futime if pfutime==.
replace coxtime=pfutime if futime==.
list opdate fudate pfudate futime pfutime coxtime


    |    opdate      fudate     pfudate   futime   pfutime   coxtime |
 76. | 10 Nov 04   18 Apr 05   23 May 08      159      1290      1290 |
 77. | 25 May 04   16 Sep 04   23 May 08      114      1459      1459 |
 78. | 24 Aug 04   01 Dec 04   30 Jun 08       99      1406      1406 |
 79. | 28 Feb 05   22 Sep 05   26 Jun 08      206      1214      1214 |
 80. | 06 Jan 05   13 Apr 05   15 Oct 08       97      1378      1378 |
     |----------------------------------------------------------------|
 81. | 10 Jan 05   18 Apr 05   15 Sep 08       98      1344      1344 |
 82. | 14 Apr 05   06 Jun 05   25 Jun 08       53      1168      1168 |
 83. | 22 Jun 05   04 Oct 05   24 Jun 08   -72944    -71950    -71950 |
 84. | 15 Jan 87   10 Feb 96           .     3313         .      3313 |
 85. | 31 Aug 92   20 Mar 94           .      566         .       566 |
     |----------------------------------------------------------------|

Regards,
Moleps
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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