I am currently working on a dataset (monthly flows of tourists between each pair of regions (O-D) during the period 2011-2015).

Regarding the variables of interest:

TEMP_D jt : Monthly average temperature in Region´s capitals of destination j during month t (º C)
ORIGIN DESTINATION MONTH YEAR TEMPERATURE DESTINATION LAGGED TEMPERATURE DESTINATION
1 1 1 2011 5 .
1 1 2 2011 10 5
1 2 1 2011 15 .
1 2 2 2011 20 15
I want to create the last column as a lagged (previous month in the same year) temperature at destination for each region.

I tried to enter this command: gen int date = ym( year, month) gen tempd_L1= temp_d[_n-1] Repeated time values within panel I do not know how to create them when repeating temporal values ​​for each region
Kindly regards, Cesar Muñoz