Statalist


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

Re: st: Date format export to excel


From   Neil Shephard <[email protected]>
To   [email protected]
Subject   Re: st: Date format export to excel
Date   Wed, 10 Dec 2008 11:55:59 +0000

Ashim Kapoor wrote:
> Hello Neil,
>
> Thank you for your reply.
>
> For example the number 586 which under the format %tm mean November
> 2008 in Stata becomes 11/8/2008 in excel, where does excel choose this
> 8th day from ?
>
> But more than this some dates get even the month wrong like for
> example the number 500 which is september 2001, becomes 9/1/2008. The
> year changes!!!
>
>   
Are the '586' and the '500' the format of the dates in the file you are
-outsheet-ing to or is this from within Stata?

Open the text file and look at how these have been -outsheet-ed and this
may provide some insight as to why things are happening strangely.
> Does this seem like a simple problem to fix ? Anything like this have you seen?
>   
I'm not very familiar with Excel, but I suspect you are assuming that
Stata and Excel are using the same (arbitrary) reference date for
calculating elapsed dates which is not the case.  In Stata elapsed dates
are counted from 01jan1960 whilst in Excel 2007 they are counted from
00January1900.

The solution is likely to be to -outsheet- with labels and converting
the string dates to the correct format in Excel.

Neil

-- 
"Only two things are infinite, the universe and human stupidity, and I'm not sure about the former." - Albert Einstein


***********************************************************************
This  message  may  contain  confidential and  privileged  information.
If you  are not the  intended recipient  you should not  disclose, copy
or distribute information in this e-mail or take any action in reliance
on its contents.  To do so is strictly  prohibited and may be unlawful.
Please  inform  the  sender that  this  message has  gone astray before
deleting it.  Thank you.

2008 marks the 60th anniversary of the NHS.  It's an opportunity to pay
tribute to the NHS staff and volunteers who help shape the service, and
celebrate their achievements.

If you work for the NHS  and  would like  an NHSmail  email account, go
to: www.connectingforhealth.nhs.uk/nhsmail
***********************************************************************

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