Hi Statalisters,
I have data that looks like this:
I want to drop observations that have a missing value for ceoann AND where year and the first four characters of becameceo (which also indicates the year) do not match.
I am still unsure how to do this in Stata.
I'm assuming the code would be something like: drop if ceoann=="" &
but I have no idea what the rest should look like.
I came across the string functions like strpos, but I guess those are only for string variables? In my case year is integer and becomeceo is long.
I would appreciate any help with this matter!
KR,
Shaquille Wijngaarde
I have data that looks like this:
year | becameceo | ceoann | .. | .. |
2006 | 20060330 | CEO | ||
2003 | 20100615 | CEO | ||
2004 | 20040718 | - | ||
2009 | 20170405 | - |
I am still unsure how to do this in Stata.
I'm assuming the code would be something like: drop if ceoann=="" &
but I have no idea what the rest should look like.
I came across the string functions like strpos, but I guess those are only for string variables? In my case year is integer and becomeceo is long.
I would appreciate any help with this matter!
KR,
Shaquille Wijngaarde
Comment