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
Which model to use?I have a panel of companies, their advertising levels, and public sentiment. I am trying to estimate…
convert strL to str#I tried to convert my key variable "name" from strL to str# to merge two datasets. However, the erro…
semipari would like to save standard errors after semipar run. Please help …
Dummy variable?I am working on a project testing to see the relationship between home runs and attendance in Major …
simple programming questionI have three variables: a FIRM(i.e company) identifier, a YEAR value, and a CODE value. I want to co…
Subscribe to:
Post Comments (Atom)
0 Response to replacing missing values with a specific year observation
Post a Comment