Dear Statalisters,
I have perhaps a rather basic question I do not know the answer to. I have a list of events with a particular date (in my case European Council summits) captured in one variable and a list of events with another date (in my case occurrences of politicians' tweets). I would like to create a thirnd varibales( dichotomous), which would capture whether a tweet has occurred with plus/minus 15 days of an European Council summit.
This is an example from my dataset:
Achieving it is basically easy using the following:
However, with hundreds of occurrences of one event (European Council summits) this would be time-consuming as one would have to manually calculate plus/minus 15 days for each summit and input it into the command.
Is there a more elegant solutions?
Many thanks, and best wishes
Jan
I have perhaps a rather basic question I do not know the answer to. I have a list of events with a particular date (in my case European Council summits) captured in one variable and a list of events with another date (in my case occurrences of politicians' tweets). I would like to create a thirnd varibales( dichotomous), which would capture whether a tweet has occurred with plus/minus 15 days of an European Council summit.
This is an example from my dataset:
Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input float(European_Council Tweet_date Tweet_Summit)
17776 17794 .
17820 17829 .
17843 17939 .
17877 17585 .
17957 18067 .
17975 18074 .
17992 18085 .
18066 17947 .
18157 18137 .
18199 18167 .
18220 18174 .
18241 18209 .
. 18249 .
. 18249 .
. 18308 .
end
format %td European_Council
format %td Tweet_date
label values Tweet_Summit Yes_No
Code:
replace Tweet_Summit=1 if inrange(Tweet_date, dmy(17,8,2008), dmy(16,9,2008)) (0 real changes made)
Is there a more elegant solutions?
Many thanks, and best wishes
Jan

Comment