Hello together.

I need help and search for a simple way to "group" my summary statistics.

My current Stata code is as follows: by year,sort :tabstat variable1 variable2 , s(n mean ...)

It gives me the number of observations and mean as output for each year...

... however, I now like to group the years by let's say (2000, 2001, 2002 and 2003) and (2004, 2005, 2006, 2007).

Is there an easy way to do this without creating new variables?

Thank you!

Konstantin