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?
Dropping all but the highest value per individual, multiple recordsHi Statalist colleagues! Thanks to your previous help, I was able to create an indicator variable f…
Using Mata*Inside Stata Program LoopHello, I am attempting to write a Stata/Mata program which formats excel files using Mata, by loopi…
Calculating CAAR (Event Study)Hello, I am trying to calculate a variety of CAARs for my dataset. I already have calculated the ave…
Replacing pieces of code with one lineIs there a code with which i can replace certain areas of a larger code while only one line For exa…
Trouble configuring use of whereis with Word for Mac and markstat in Stata 16Hello all, I very happily developed a .do file on a Windows 10 machine using markstat with pandoc a…
Subscribe to:
Post Comments (Atom)
0 Response to How do I fill in missing values using the highest/last observation-year?
Post a Comment