calculating a mean value in overlapping periods

I would like to find a mean value of a variable in overlapping time periods using rolling command in STATA. I typed
rolling, window(20) clear: egen avg = mean(var name)
However, STATA returned r(N) which is the number of years in the sample rather that the mean value I wanted. What have I done wrong???
Thank you so much.