Statalist


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

st: AW: Converting date/clock format to date format?


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: AW: Converting date/clock format to date format?
Date   Mon, 20 Jul 2009 13:50:56 +0200

<> 

Note the different results here. The underlying value of the variable
remains the same, -format- does not change it:


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

input str10 mydate 
13dec2007 
14dec2007    
20dec2007 
21dec2007  
27dec2007
28dec2007
02jan2008
end

compress

gen date=date(mydate, "DMY")

clonevar date2=date
clonevar date3=date
clonevar date4=date

form date %tdMonth_DD,_CCYY
form date2 %tc
form date3 %tw
form date4 %dD_m_Y

list, noobs
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Miranda Kim
Gesendet: Montag, 20. Juli 2009 12:21
An: [email protected]
Betreff: st: Converting date/clock format to date format?

Hi there,
Could anyone help me with this?
I want to merge two datasets together that both have a 'datereturn' 
variable.
They have different formats however. In one it is a %tc and in the other 
%dD_m_Y.
Where it is %tc format I cannot convert it to a date format...
If I type
format datereturn %dD_m_Y
It displays: 1478563200000
I know this is probably very basic, bu I'd be very grateful for some help...
Thanks a lot!

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