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]
Re: st: diff data types for date var while importing from various sources
From
Richard Herron <[email protected]>
To
[email protected]
Subject
Re: st: diff data types for date var while importing from various sources
Date
Thu, 28 Jun 2012 12:26:10 -0400
How are your dates stored in the database? Stata stores dates as
numbers, but displays them as dates after you -format- them. See -help
date- for more.
When you use the -stockquote- package (from SSC, please state sources)
Stata downloads the .csv file from Yahoo! Finance, where dates are
stored as "YYYY-MM-DD" that Stata -insheet-s as a string. -insheet- is
naive and doesn't know these strings are dates. You must convert this
with something like -date(date, "YMD")-.
Richard Herron
On Thu, Jun 28, 2012 at 11:59 AM, tashi lama <[email protected]> wrote:
>
> Hello,
>
> When I use odbc command to import data variable from sql database into stata, date variable turns numeric datatype. Quite contrary, when I use stockquote to import data variable to stata from yahoo finace, it assigns string datatype to date. Any idea or cOuld someone point me to a documentation how stata assigns datatype to imported variable specifically date?
>
>
>
> Thanx,
>
> Tashi
> *
> * 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/