Select Cases Loop

#1
Hi,
I have data that has changed significantly over time, so a linear regression does not fit well. Instead, I'd like to select the data in 5 year pieces, and perform regressions on each one (eg. 1981-1985, 1982-1986, 1983-1987). Then I want to save the coefficients and R2 and model them in a histogram to determine if the factor affects the dependent mostly positively/ negatively and mostly strong/weak .
Is there a way to do this using a loop function instead of selecting the cases every time and running a separate regression?
I've attached a graph of my data for reference.