Dear Stata-Listers,
I have the feeling that the solution is quite easy. However, I just can't figure it out.
So, I have cross sectional data for regional districts in Germany with differing observations per year, for the years 2012 to 2015.
The variable A is asked in the years 2014 and 2015 only.
Much like so:
When:
I get beta=72.3
What I would like to do now is set variable A in the year 2013 to A(year=2014)-72.3 for each district separately.
The tsset command does not work, which is why I can't work with forward values, like:
by district: A = F.A - 72.3 if year < 2015
Is there a simple solution to my problem?
I would very much appreciate any help!
With kind regards
Torben
I have the feeling that the solution is quite easy. However, I just can't figure it out.
So, I have cross sectional data for regional districts in Germany with differing observations per year, for the years 2012 to 2015.
The variable A is asked in the years 2014 and 2015 only.
Much like so:
A | year | district |
. | 2012 | 1 |
. | 2012 | 2 |
. | 2013 | 3 |
. | 2013 | 1 |
212 | 2014 | 1 |
123 | 2014 | 2 |
234 | 2014 | 3 |
345 | 2015 | 1 |
123 | 2015 | 2 |
235 | 2015 | 2 |
345 | 2015 | 3 |
Code:
reg A year
What I would like to do now is set variable A in the year 2013 to A(year=2014)-72.3 for each district separately.
The tsset command does not work, which is why I can't work with forward values, like:
by district: A = F.A - 72.3 if year < 2015
Is there a simple solution to my problem?
I would very much appreciate any help!
With kind regards
Torben
Comment