Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: date function


From   "Dherani, Mukesh" <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: date function
Date   Tue, 6 Aug 2013 14:52:02 +0000

Dear all,
I have a problem getting my date variable sorted.  I have Date variable in = my data (float) and I want month and year extracted using

gen month=3Dmonth(date)..... same for day and yr.
However, I am getting incorrect values for month and year (even day).
I have also tried formatting month and year to %m and %ty, but to no avail.
Any help appreciated... I am using stata 10. [no luck with FAQ so far]


date               day         month  		yr
19/02/2003         22           3              1960
17/01/2003         25           1              1960
03/01/2003         10           1              1960
23/01/2003         16           2              1960
03/01/2003         10           1              1960
07/01/2003         7              4              1960
10/01/2003         30           1              1960
18/07/2003         14           2              1960
25/04/2003         10           4              1960
05/04/2004         5              2              1960
03/01/2003         10           1              1960
19/06/2003         21           2              1960
13/06/2003         5              1              1960
19/08/2003         12           4              1960


Thank you in advance.




Dr. Mukesh Dherani
Research Fellow
The University of Liverpool


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


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index