st: while loop

I have a panel dataset with countries and years. I
am trying to do some regressions for every country in windows of 5 years. I want
these 5 years to be overlapping so for example for United States, I want the
first regression to be for 1980-1984, the second 1981-1985, third 1982-1986 and
goes on like this. I have used loop within a loop to do this. As you can see
from the do file below