|
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: Re: converting dates from Excel .csv file
< >
This advice is not stable across platforms on which Excel runs. Not
all versions of Excel have the base date 1 January 1900.
I recommend ensuring that in Excel you have four-digit years in the
display format of any date field. Then a .csv file containing such
date fields is easily read, and those fields converted to Stata dates.
Kit Baum, Boston College Economics and DIW Berlin
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html
On Aug 29, 2008, at 02:33 , John wrote:
Another trick with Excel dates (assuming you have the software) is to
open the sheet in Excel and apply a general or numeric format to the
date column. This will show you that (at least for dates subsequent
to
1/1/1900) Excel uses elapsed days as well*. All you need to do is
subtract Stata's Day 0 in Excel's number line, 21916 (1/1/1960) from
the
Excel elapsed day and you'll get a number that, once imported into
Stata, can be formatted to show the correct date.
E.G.: Date = Aug 28th, 1963
Excel numeric equivalent: 23251 - 21916 = Stata's elapsed day 1335
. di %dM_d,_CY 1335
August 28, 1963
*
* 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/