Hi everyone 
In my dataset I have the number of terrorist attacks, each year, in each country.
What I would like to generate is a variable that would be the average number of attacks by country every 5 years (like average number of attacks between 1995 and 2000, then 2001 and 2006 and so on)
The idea would be to run something like this:
egen terroraverage= sum(terror), by (country 5years)
I know this command is not correct since i dont have any variable "5 years", it is just to give you the insight.
How can i do it please ?
Thanks in advance,
Killian Foubert

In my dataset I have the number of terrorist attacks, each year, in each country.
What I would like to generate is a variable that would be the average number of attacks by country every 5 years (like average number of attacks between 1995 and 2000, then 2001 and 2006 and so on)
The idea would be to run something like this:
egen terroraverage= sum(terror), by (country 5years)
I know this command is not correct since i dont have any variable "5 years", it is just to give you the insight.
How can i do it please ?
Thanks in advance,
Killian Foubert
Comment