Hi,
I need to code a loop, my data looks (simplified) like this:
Obs Type Time
1 QUOTE 12:01:00
2 TRADE 12:02:00
3 QUOTE 12:03:00
4 QUOTE 12:04:00
5 QUOTE 12:06:00
6 TRADE 12:18:00
7 QUOTE 12:23:00
8 TRADE 12:28:00
9 QUOTE 12:29:00
10 QUOTE 12:30:00
11 TRADE 12:32:00
12 QUOTE 12:36:00
13 TRADE 12:42:00
Basically, what I want to do is count the trades that took place in the last half an hour. So using obs 13 as an example, I want to write a loop that counts the trades (and not the quotes) between 12:12:00 and 12:42:00. The output will count obs 6,8 & 11 so the result will be a new variable (say Trade_Count) with a value of 3.
Is a loop even the way to go? I admit that I am a novice, but hopefully with some help I can eventually begin to contribute to the forum. I have three large SAS books on route from Amazon so I have a fun time of becoming a self-taught pro ahead!
Mark
I need to code a loop, my data looks (simplified) like this:
Obs Type Time
1 QUOTE 12:01:00
2 TRADE 12:02:00
3 QUOTE 12:03:00
4 QUOTE 12:04:00
5 QUOTE 12:06:00
6 TRADE 12:18:00
7 QUOTE 12:23:00
8 TRADE 12:28:00
9 QUOTE 12:29:00
10 QUOTE 12:30:00
11 TRADE 12:32:00
12 QUOTE 12:36:00
13 TRADE 12:42:00
Basically, what I want to do is count the trades that took place in the last half an hour. So using obs 13 as an example, I want to write a loop that counts the trades (and not the quotes) between 12:12:00 and 12:42:00. The output will count obs 6,8 & 11 so the result will be a new variable (say Trade_Count) with a value of 3.
Is a loop even the way to go? I admit that I am a novice, but hopefully with some help I can eventually begin to contribute to the forum. I have three large SAS books on route from Amazon so I have a fun time of becoming a self-taught pro ahead!
Mark