Dear Stata users and experts,
I'm dealing with a monthly data for a few years.
Let me denote month no., by m and year no., by y. What I need to do
is to generate a variable B{m,y}=A{m,y-1}. A is a variable that is
already in the dataset.
This sounded quite simple to me till I tried a lot in vain.
Could anyone give a solution for this simple problem?
Assuming your data are -tsset- at a monthly frequency, you can use
the lag operator: L12.a will give you the 12-month (i.e. one-year)
lag of the variable 'a'. Additional information is available in [U]
11.4.3, or (in Stata 9.2) type -hsearch lag operator-. HTH.