Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[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 <richard.c.herron@gmail.com>
To   statalist@hsphsun2.harvard.edu
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 <ltashi32@hotmail.com> 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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index