-1

I have percent change of a variable for 20 years. I want to find the average percent change for 3 years continuously over the 20 years. So, suppose I have the data from 2000-2020. I want to form the average of 2000,2001,2002, then, 2001,2002,2003, and so on. in groups of 3 till 2018,2019,2020 in Stata.

Please help me with the code.

  • 1
    I;ve answered this but downvoted as not showing any research effort whatsoever. Nor do you include a data example or phrase your question in terms of an accessible Stata dataset. See the Stata tag wiki for positive advice. – Nick Cox Jan 28 '22 at 14:49

1 Answers1

0

This is just a running mean or moving average. (For some reason, running average and moving mean aren't expressions I ever hear.) So you need to tsset or xtset your data and then look at help tssmooth ma.

Nick Cox
  • 35,529
  • 6
  • 31
  • 47