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
storing significant coefficients only - by firm regressionHello there, I am trying to store the beta coefficients with their t-stats and p-value but am unabl…
How to calculate CFO TENUREHi everyone, I need to calculate the CFO tenure. May I request for your guidance in its calculation?…
When to divide in subpopulations, using the margins command (AME) in a logit model?My goal is to compare the AMEs between two subpopulations of my sample in a logit model. However, th…
Extract year from datetime variableHello all, I am trying to extract the years from a datetime variable and do not seem to find a way.…
Time trends in classical DiDI was reading the article titled "Mobilize for Our Lives? School Shootings and Democratic Accountabi…
Subscribe to:
Post Comments (Atom)
0 Response to replacing missing values with a specific year observation
Post a Comment