I am looking to create a variable (COUNT_WITHIN_2_DAYS
) that is the count of observations in a date range. The range would be the stated date +/- 2 days.
ID# DATE COUNT_WITHIN_2_DAYS
1 1/1/2000 3
2 1/2/2000 4
5 1/2/2000 4
6 1/4/2000 3
9 1/12/2000 1
11 3/1/2001 2
12 3/3/2000 4
16 3/4/2000 3
18 3/5/2000 3
21 3/8/2000 1
I tried an egen
with an if
command but that did not work
if
command and theif
qualifier. - Nick Cox