I seem to be stuck trying make 5th lags of my panel data for counries on government debt from 1990 to 2015.
I assume I have to use foreach in something like

Code:
foreach var of varlist Govdebt* {
gen lag_`var'=
}
But I can't seem to make it work the right way.
The lag should be for example Govdebt2015-Govdebt2010 and so on.

I also want to generate a variable that equal to the value 5 years ago, i.e. Govdebt2015=Govdebt2019 and so on.


My data set looks like this, with Govdebt from 1990 to 2015.

Govdebt2001 Govdebt2002 Govdebt2003 Govdebt2004 Govdebt2005 Govdebt2006 Govdebt2007 Govdebt2008 Govdebt2009
.60612782 .64096916 .60244562 .57474271 .58203359 .56688106 .53550303 .55139806 .5966646
.598002 .594001 .506477 .393408 .285524 .24303 .136137 .08387151 .10163963
.801735 .72972 .597706 .51953736 .35736634 .18696562 .16065564 .16646515 .22709667
1.2202501 1.2816504 1.2751906 1.2298511 .94990176 .90867928 .79201681 .77271031 1.0246006
.49435502 1.5211176 1.2856114 1.1711633 .66938213 .58622172 .50841697 .43852988 .53828417
.362702 .366753 .331351 .289247 .208491 .180946 .14249499 .14630964 .34135788
0 0 0 0 0 0 0 0 0
.1704079 .14953917 .13150986 .11890017 .10893213 .09966902 .09682676 .11743649 .16746599
.67325137 .66590948 .65740104 .65372439 .68314512 .67044184 .6480822 .68517678 .79725831
.24387309 .23017812 .21828259 .19997102 .13498488 .10260772 .08311254 .07291678 .12394766
.23245318 .24019862 .26617396 .27313857 .28135065 .2907306 .29345438 .32488041 .39445081
.26074931 .28377489 .32449279 .29394342 .24191819 .20250049 .16343552 .12562008 .21360919

I really hope someone can provide help with these two new variables.

Best,
Clara