Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

st: AW: Date format


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: AW: Date format
Date   Mon, 8 Mar 2010 16:47:37 +0100

<> 



*************
clear*

inp str20(exitdate entrydate) 
"22jan2010 00:00:00"  "01jan2008 00:00:00"
"22jan2010 00:00:00"  "16jan2009 00:00:00"
"22jan2010 00:00:00"  "01jan2006 00:00:00"
"22jan2010 00:00:00"  "16jan2008 00:00:00"
"22jan2010 00:00:00"  "16jan2009 00:00:00"
"22jan2010 00:00:00"  "15jun2008 00:00:00"
"22jan2010 00:00:00"  "15jun2008 00:00:00"
"22jan2010 00:00:00"  "01jan2007 00:00:00"
"22jan2010 00:00:00"  "01jan2005 00:00:00"
"22jan2010 00:00:00"  "01jan2007 00:00:00"
end

gen int newexitdate=dofc(clock(exitdate, "DMY hms"))
gen int newentrydate=dofc(clock(entrydate, "DMY hms"))
form newentrydate newexitdate %tdMon_dd,_CCYY
list new*, noobs
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Mansour Ndiath
Gesendet: Montag, 8. März 2010 11:30
An: statalist@hsphsun2.harvard.edu
Betreff: st: Date format

hello guys
I am experincing difficulties in formatting dates with stata. I have two
variables Entrydate and Exitdate I want to change the format into DMY. How
can I got about it? any support is much appreciated  
here is the output of the variables
+-----------------------------------------+
     |           Exitdate            entrydate |
     |-----------------------------------------|
  1. | 22jan2010 00:00:00   01jan2008 00:00:00 |
  2. | 22jan2010 00:00:00   16jan2009 00:00:00 |
  3. | 22jan2010 00:00:00   01jan2006 00:00:00 |
  4. | 22jan2010 00:00:00   16jan2008 00:00:00 |
  5. | 22jan2010 00:00:00   16jan2009 00:00:00 |
     |-----------------------------------------|
  6. | 22jan2010 00:00:00   15jun2008 00:00:00 |
  7. | 22jan2010 00:00:00   15jun2008 00:00:00 |
  8. | 22jan2010 00:00:00   01jan2007 00:00:00 |
  9. | 22jan2010 00:00:00   01jan2005 00:00:00 |
 10. | 22jan2010 00:00:00   01jan2007 00:00:00 |
     +-----------------------------------------+
Mansour Ndiath
Senegal


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index