Hi, greetings!
I appreciate your presence, because you are always available whenever I need a help.
Thank you so much in advance, and the problem which is troubling me is the following:
I have a sort of brokerage houses' announcements data on a daily basis.
House_id
Annc_dates
House_close
1
7/1/1996
0
1
8/21/1996
0
1
9/4/1996
0
1
10/1/1996
0
1
11/1/1996
0
1
12/26/1996
0
1
1/28/1997
0
1
2/24/1997
0
1
3/21/1997
0
1
4/29/1997
0
1
5/15/1997
0
1
8/14/1997
0
1
11/3/1997
1
….........
5
4/20/2000
0
5
5/12/2000
0
5
6/5/2000
0
5
10/12/2000
0
5
11/9/2000
0
5
12/14/2000
0
5
1/26/2001
0
5
2/27/2001
0
5
3/6/2001
0
5
5/23/2001
0
5
7/31/2001
0
5
9/11/2001
1
6
11/11/1987
0
6
12/3/1987
1
What I want to do, is to highlight one-year time span of observations before a house closes (that is, from the last date of a house in the data). For this, I created a variable "House_close" with 1 for the closing (last) dates, and 0 otherwise.
What I want to obtain is like the below:
House_id
Annc_dates
House_close
Span_closing
1
7/1/1996
0
0
1
8/21/1996
0
0
1
9/4/1996
0
0
1
10/1/1996
0
0
1
11/1/1996
0
1
1
12/26/1996
0
1
1
1/28/1997
0
1
1
2/24/1997
0
1
1
3/21/1997
0
1
1
4/29/1997
0
1
1
5/15/1997
0
1
1
8/14/1997
0
1
1
11/3/1997
1
1
….........
5
4/20/2000
0
0
5
5/12/2000
0
0
5
6/5/2000
0
0
5
10/12/2000
0
1
5
11/9/2000
0
1
5
12/14/2000
0
1
5
1/26/2001
0
1
5
2/27/2001
0
1
5
3/6/2001
0
1
5
5/23/2001
0
1
5
7/31/2001
0
1
5
9/11/2001
1
1
6
11/11/1987
0
1
6
12/3/1987
1
1
As you see, I created a new variable "Span_closing." For House_id = 1, the closing date is 11/3/1997. So, tracking all the way back to one year ago, the closest date is 11/1/1996. Over that one-year time span, I entered Span_closing = 1, otherwise = 0.
In case of House_id = 6, although it has only two observations, I entered Span_closing = 1 for all its obs based on the indicated principle.
I ask for your wisdom!
Sincerely,
KS -,
... View more