Hello,
I am using StataIC and the panel data file mathpnl. with 2750 oberservations and 57 variables.
The data file contains panel data for district's expenditures per student from 1992 to 1998.
In order to run an IV regression, where I want to control for initial spending in 1992, I need to generate a new variable.
I have tried the code:
// gen exp1992= rexpp if year == 1992 //
and this gives me a new variable with the value for expenditures (only) in the year 1992.
But actually I want my dataset to look like the example in the table below (with the thick letter), where it gives me the value of expenditures in 1992 for every observation.
I have tried several codes but it didn't work out.
Is there any possibility to adjust my code in order to receive the result?
I am using StataIC and the panel data file mathpnl. with 2750 oberservations and 57 variables.
The data file contains panel data for district's expenditures per student from 1992 to 1998.
In order to run an IV regression, where I want to control for initial spending in 1992, I need to generate a new variable.
I have tried the code:
// gen exp1992= rexpp if year == 1992 //
and this gives me a new variable with the value for expenditures (only) in the year 1992.
But actually I want my dataset to look like the example in the table below (with the thick letter), where it gives me the value of expenditures in 1992 for every observation.
rexpp | year | exp1992 |
125.312 | 1992 | 125.312 |
176.418 | 1993 | 125.313 |
Is there any possibility to adjust my code in order to receive the result?
Comment