Dear all,
I am a stata beginner so this question might sound stupid. I have a dataset that list persons in a board of a public company for a given year. Moreover, I have specified whether someone is the CEO or not and if there has been a CEO succession event. The data is sorted by company and year. Now, I want to drop all the observations for a given company if there is no CEO succession event (for example, when the CEO remains in function in the whole period). If there is a CEO succession event, I want to keep all the observations (including the years where no succession is present). Looking at the screenshot below, I would like to drop all companies that look like that (where the CEO in the first year is also CEO in the last year). So, conceptually, all companies would be a separate group, then if this group (company) does not contain a ceo_change, the whole group gets dropped and if it does contain a ceo_change, the whole group stays.
I hope someone can help me with this, thanks in advance!
Array
Related Posts with Dropping group of variables if the group does not contain a certain value
CMP mata error 3900Hi all, I was trying to use State to run a CMP model with random coefficient. And I got the error b…
Generate a date variable from another date variable with an if conditionHere I am trying to create a start date (AESTDAT) and end date (AEENDAT) variables from the list bel…
Exporting two way table to latexHi, I have two string variables Var1 and Var2 each with 7 categories. I want to create a two way ta…
Importing data - 1st row (names) not correctlyHello, I want to import an excel spredsheet and use the first row as the name of the variable. For t…
Function HandlesIs there something similar to MATLAB's function handles in MATA? It seems like it would be similar t…
Subscribe to:
Post Comments (Atom)
0 Response to Dropping group of variables if the group does not contain a certain value
Post a Comment