Hello everyone, I need some help in composing a code for replacing missing values with the value of a specific year-observation. I have data structured in the following way:
id company year dum1
1 comp1 2013 1
1 comp1 2014 .
1 comp1 2015 .
1 comp1 2016 .
1 comp1 2017 .
1 comp1 2018 .
1 comp1 2019 .
2 comp2 2013 0
2 comp2 2014 .
2 comp2 2015 .
2 comp2 2016 .
2 comp2 2017 .
2 comp2 2018 .
2 comp2 2019 .
3 comp3 2013 .
3 comp3 2014 .
3 comp3 2015 .
3 comp3 2016 .
3 comp3 2017 .
3 comp3 2018 .
3 comp3 2019 .
I would like to replace missings in variable dum1 with the values of year 2013 observations so that for company 1 all subsequent years-obs. will have 1 as value, for company 2 will have 0 as value, for company 3 will have . as value.
How can I do it?
Many thanks!
Related Posts with replacing missing values with a specific year observation
Oaxaca decomposition in OLS and unconditional quantile regressionDear all, I'm actually performing an Oaxaca-Blinder decomposition to test wether the returns of ind…
Reshape to convert large number of variables to long formatHi Stata, I am pretty new to Stata and try to reshape my Data to long format. My Dataset ist from …
Significance of Cramer's VHi I have a question about the significance of Cramer's V. I calculated the Carmer's V by using C…
How to regreee the variables with different coefficientHi community, My equation is attached. A, B, C, D is dummy variables and i already solve them. May …
Interpolation (ipolate/csipolate)Hi, I want to use a ipolate command to create monthly GDP estimates from quarterly data. My data l…
Subscribe to:
Post Comments (Atom)
0 Response to replacing missing values with a specific year observation
Post a Comment