Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: String -> date format conversion with insheet


From   "Eric Hixson" <[email protected]>
To   [email protected]
Subject   st: String -> date format conversion with insheet
Date   Fri, 21 Nov 2003 10:52:38 -0500

I have a dataset with dates that I am brining into Stata via insheet.  The data is comma delimited and the dates are being formatted by the source database like the following:

3/12/03 0:00:00
11/5/03 0:00:00

Unfortunately I can't get rid of the h/m/sec portion at the source and Stata is formatting the field as a string.  I want to convert the m/d/y portion to a date to allow time series analysis.

I tried dstring as a first step and got the following:

. destring dischdate, g(ddate) ignore(" 0:00:00")
dischdate contains characters not specified in ignore(); no generate

The same error was produced with and without the quotes and/or leading space in the ignore statement.  Recast does not allow date as a type.

Any thoughts on how to handle the conversion would be appreciated.

Thanks,
Eric



------------------------------------------------------------------------------
Confidentiality Note:  This message is intended for use only by the individual or entity to which it is addressed and may contain information that is privileged, confidential, and exempt from disclosure under applicable law.  If the reader of this message is not the intended recipient or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited.  If you have received this communication in error,  please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy.  Thank you.
==============================================================================


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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