I am trying to lag a time series variable (spread_eur, the spread between two interest rates).
I tried using:
but this shifts it the wrong direction. I then tried with [_n+5] and Stata returns missing value for every value of the variable.
I then tried with:
And I get error messages:
and then:
Using tsset should fix the second error, but I am not sure about the first one?
Thank you!
I tried using:
Code:
gen spread_eur_lag5 = spread_eur replace spread_eur_lag5 = spread_eur_lag5[_n-5]
I then tried with:
Code:
tsset spread_eur_test generate eurL1=L1.spread_eur_test
Code:
time variable must contain only integer values
Code:
time variable not set
Thank you!
Comment