I have a dataset akin to this
User Date Value
A 2012-01-01 4
A 2012-01-02 5
A 2012-01-03 6
A 2012-01-04 7
B 2012-01-01 2
B 2012-01-02 3
B 2012-01-03 4
B 2012-01-04 5
I want to create a lag of Value, respecting User.
User Date Value Value.lag
A 2012-01-01 4 NA
A 2012-01-02 5 4
A 2012-01-03 6 5
A 2012-01-04 7 6
B 2012-01-01 2 NA
B 2012-01-02 3 2
B 2012-01-03 4 3
B 2012-01-04 5 4
how can i do this in stata??
Related Posts with How to find lag of a variable in long format panel dataset?
Westerlund error-correction-based panel cointegration testsDear all, I am trying to do panel cointegration test using xtwest command or using Westerlund(2007) …
Adding up deposits over year and customer from monthly dataHi there This is how my dataset looks. There are 1,845,832 observations in it. Code: * Example g…
Estimating shares for a categorical variable per year and per stateHi all, I have a categorical variable with three categories (1, 2, 3). I want to find the percentag…
Westerlund error-correction-based panel cointegration testsDear all, I am trying to do panel cointegration test using xtwest command or using Westerlund(2007) …
Implementing part of normal equations manually Code: * Example generated by -dataex-. To install: ssc install dataex clear input float ones int(x…
Subscribe to:
Post Comments (Atom)
0 Response to How to find lag of a variable in long format panel dataset?
Post a Comment