managing high frequency data

For questions and discussion related to reading in and working with data.
moroche
Posts: 4
Joined: Mon Mar 19, 2007 11:18 am

managing high frequency data

Unread post by moroche »

Dear Tom,
I am using exchange rate quotes by the second.

As you can imagine sometimes there are no quotes in any given second and I want to use a previous quote.

For example I have data on prices for A B C as follows
A B C
P11 P12 P13
NA P22 NA
P31 NA P33
P41 NA NA

I can use P11 P12 P13 for my first observation.
I want to use P11 P22 P13 for my second observation.
I want to use P31 P22 P33 for my third observation.
I want to use P41 P22 P33 for my fourth observation.

etc.

Is there some code (or command) in RATS that permits me to use the current or most recent observation? In other words when RATS sees a missing value it looks for the most recent value.

regards,
Maurice
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Unread post by TomDoan »

The following will replace p by its last valid observation:

compute lastvalid=%na
set p = lastvalid=%if(%valid(p),p,lastvalid)

(If you never have a missing value as the first observation, you can skip the compute lastvalid=%na).
Post Reply