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: changing date format


From   "Mike Kim" <[email protected]>
To   <[email protected]>
Subject   st: changing date format
Date   Sat, 4 Sep 2010 21:11:50 -0500

Dear Statalisters,

I imported daily stock data from CRSP. The data shows date like this:

tradedate
20010102
20010103
20010104
20010105
20010106
20010107
......

Neither of the following commands works: 
- format tradedate %td
- gen date=date(tradedate, "MDY")

I split tradedae into month, day, year in excel, imported into Stata, and
used the following command to combine them. 
- gen date=mdy(month,day,year)

Is there any way I can change tradedate into Stata date format without using
excel?

Thank you in advance,
Mike.


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