Hi all
I have a dataset that looks like this
date id id2 x
1 1 A 1
2 1 A 2
1 1 B 6
2 1 B 9
1 1 C 3
2 1 C 0
I am using rangestat to find in a rolling way for each row the maximum and minimum values of x "seen" by id (I have many id's). However, the catch is that when looking back for each row, I want to exclude the cases where id2 equals the id2 of that row.
So, for example, for the second row (date=2 for id2=A), the set from which the maximum is drawn should exclude x=1 (date=1, id2=1A) and be drawn from (6,9,3,0, i.e., dates 1 and 2 when id2 is B or C).
Thank you very much!
Costas
I have a dataset that looks like this
date id id2 x
1 1 A 1
2 1 A 2
1 1 B 6
2 1 B 9
1 1 C 3
2 1 C 0
I am using rangestat to find in a rolling way for each row the maximum and minimum values of x "seen" by id (I have many id's). However, the catch is that when looking back for each row, I want to exclude the cases where id2 equals the id2 of that row.
So, for example, for the second row (date=2 for id2=A), the set from which the maximum is drawn should exclude x=1 (date=1, id2=1A) and be drawn from (6,9,3,0, i.e., dates 1 and 2 when id2 is B or C).
Thank you very much!
Costas
Comment