- Thread starter CharlesOG
- Start date

My suggestion for now is to create your time variable without the clock command. For instance if you have exactly 5 minutes between two consecutive records you can create a variable time with "egen time = group(date)". And if you don't, you can imagine smtg like "gen time = 60*real(substr(date, and where hours are written)) + real(substr(date, and where minuts are written))" etc.".

Hopte this helps!

Hey. Im not really sure what you mean.

Here an example of what my data is like:

time

02/19/2007_21:45

02/19/2007_21:50

02/19/2007_21:55

02/19/2007_22:00

02/19/2007_22:05

Exchange Rate

1.2317

1.232

1.2326

1.2327

1.2332

Using this small sample, im giving this command to identify time as the time variable:

gen time2 = clock(time, "DMYhm")

And i just get 5 missing values. If you could have a go with this sample and see how to do it I'd be saved. Sorry but i dont really get your other suggestion, or how to code it.

Thanks

Here an example of what my data is like:

time

02/19/2007_21:45

02/19/2007_21:50

02/19/2007_21:55

02/19/2007_22:00

02/19/2007_22:05

Exchange Rate

1.2317

1.232

1.2326

1.2327

1.2332

Using this small sample, im giving this command to identify time as the time variable:

gen time2 = clock(time, "DMYhm")

And i just get 5 missing values. If you could have a go with this sample and see how to do it I'd be saved. Sorry but i dont really get your other suggestion, or how to code it.

Thanks

Last edited:

What happens if you store a %tc value as a float:

The largest integer that can be stored precisely in a float is

16,777,216, corresponding to 01jan1960 04:39:37.216. Times after that

will be subject to rounding; the rounding as of recent times can be as

much as 2 minutes, 11 seconds.

What happens if you store a %tc value as a double:

The largest integer that can be stored precisely in a double is

9,007,199,254,740,992, corresponding to a date in year 285,422,880.

Stata cuts off dates at year 9999, but for other reasons.

Now it depends on what you want to do with your time variable. For instance if you want to regress your exchange rates against time, what matters is to have a time variable that is correctly coded. More precisely if the dates are:

"today 12:00"

"today 12:05"

"today 12:15"

then you want the gap between in your time variable between observations 2 and 3 to be twice as large as the gap between observations 1 and 2.

Rt= βkSt + εt

Where Rt is returns and St is the GDP news. Am I right in creating a GDP variable with its figures placed in the matrix at the times it was released. The effects wear off after 15 minutes so they must be put in the right place. Then, regressing returns against the variable should give me how the news effects the exchange rate, right?

Then, the more complex model is:

Rt = β0 + (SUMMATION)βiRt-i + (SUMMATION) βk,t Sk,t-j + εt (x)

So as to include the persistence of the effects over time, so making j=5 or something to test how the effects dampen out over the 25 minutes following the release. I am concerned I am not using stata correctly to do this. I think i've got my time variables correctly coded so far. I did the 'gen time2 = clock(time, "DMYhm") command and then right clicked the variable and set it to clock and chose the format I would like. It then gave me a time variable with all the right times that would allow me to tsset it.

My issue is what to do with the news variables as they are not strictly time series data as they do not have temporally consecutive values. Do I just put them in where they are and regress or is there something better. A paper by Almeida, Goodhart and Payne called “The Effects of Macroeconomic News on High Frequency Exchange Rate Behaviour” does what I am trying to do.

Any suggestions from anybody will be much appreciated. Thanks for your help so far Etienne.