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

st: RE: time series problem


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: time series problem
Date   Wed, 17 Jul 2002 17:53:08 +0100

Michael Carney

> I am trying to analyze data from the dow jones cash market
> and the dow
> futures market. i am having the following problem:
>
> may trading program gives me data that runs in thusly, for example:
>
> TIME         PRICE
> 10:30          8250
> 10:30          8253
> 10:30          8248
> 10:31          8249
> 10:31          8250
>
> The time does not include colons and does not pose a
> problem. What is
> vexing, however, is that Stata cannot convert the data to a
> time series set
> as my trading program does not differentiate between
> different values for
> 10:30 AM, for example; exporting the data to a text file
> and pasting in
> Stata's data editor I have many different values for what
> appears to be
> 10:30, for example, but is actually 10:30 and so many seconds.
> Unfortunately, I cannot get copyable data second by second
> from my trading
> program (TradeStation). Is there any way I can code all of
> the 10:30
> values, for example, so that i can get the first datum for
> 10:30, the
> second, third, etc. coded in order to do an adequate time
> series analysis?
> I want to analyze the market tick by tick and plot a day's worth of
> statistics and run regressions with other markets. ANY help
> would be
> greatly appreciated.
>

You can generate two variables which are just

gen time = _n

and something like, assuming that TIME is string,
although I am not clear where the colons come in,

gen str1 TIME2 = ""
bysort TIME (time) : replace TIME2 = TIME + ":" + string(20 * (_n-1))

You could do computations using -time- and present them
using TIME2. Something like this may be essential anyway
as Stata does not support time of day as such.

Nick
n.j.cox@durham.ac.uk

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index