Hello everyone,
I would like to replace the missing values (leftceo) by the last given observation-year, to calculate the tenure of a CEO.
This means in my case that the three missing values should be replaced by "2020".
I tried the following command: "bysort gvkey_year: replace leftceo=max(YEAR) if missing(leftceo)". Unfortunately Stata states that it is an invalid syntax.
Could someone help me, please?
Thanks in advance!
Array
Related Posts with How do I fill in missing values using the highest/last observation-year?
Performing factor analysis with panel dataHello everyone, I have panel data with six variables concerning governance quality for 59 countries…
r(303) equation not found after using "test" command to see if coefficients = 0I am trying to test if the sum of coefficients is significantly different from 0, but for some reaso…
Merging two datasets with a common variableHello all, I am using STATA 16 Please I want to merge two datasets, using the common variable medcod…
reghdfe takes hours - how to run panel regressions with FE faster?Good morning, I have a dataset with 4 million observations on 2 million students in two points in t…
"( invalid name" r198 error while running a loop tempname sdgp_format postfile `sdgp_format' state gdp_pcap fyear using sdgp_format.dta forvalues j …
Subscribe to:
Post Comments (Atom)
0 Response to How do I fill in missing values using the highest/last observation-year?
Post a Comment