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?
Two way or one way fixed effect ??Hi, test to choose between model two way fixed effec or fixed effect ordinary ? i use STATA 14 …
Creating categories within a nominal variableHello! I am conducting an honors thesis in sociology and need help with creating categories within …
Reshape from wide to longHi everyone, I get data from Datastream and there are some firms having no data, i.e. price_14 "$$…
How to reshape the panel data rows to columnsDear Clyde Schechter and other Stata experts, I have the raw data as follows: Code: input str10 A…
Working with multiple if conditionsDear Statalist, I am browsing a dataset with multiple if conditions. Is it possible to identify the…
Subscribe to:
Post Comments (Atom)
0 Response to How to find lag of a variable in long format panel dataset?
Post a Comment