I need to calculate the total number of managers for each company in each year in my panel data. I used this command for 1999:
generate Manager1999 = 1 if 1999>= YearStartRole & 1999<= YearEndRole (I write it for each year)
bysort CompanyID Year : gen cummulativetotal = sum( Manager )
by CompanyID Year : egen totalmanager = max( cummulativetotal )
Since for some of the managers the date of start and end of role is not continuous and their ID repeats in some years more than once (for example they enter the company on January and leave the company after 3 months and again entered the company on July and stayed by the end of the year). Command above calculate manage in the above example 2 person while I want to calculate the manager just onc
A managers can be the manager of multiple companies, and I just want to exclude them in calculation if their ID repeat in one year for a unique company.
your help is appreciated.
generate Manager1999 = 1 if 1999>= YearStartRole & 1999<= YearEndRole (I write it for each year)
bysort CompanyID Year : gen cummulativetotal = sum( Manager )
by CompanyID Year : egen totalmanager = max( cummulativetotal )
Since for some of the managers the date of start and end of role is not continuous and their ID repeats in some years more than once (for example they enter the company on January and leave the company after 3 months and again entered the company on July and stayed by the end of the year). Command above calculate manage in the above example 2 person while I want to calculate the manager just onc
STATUS | CompanyID | ManagerID | Gender | DateStartRole | DateEndRole |
Continuous | 10322 | 370125 | M | 1997-03-01 | 2003-04-01 |
Continuous | 27631 | 220631 | M | 1962-01-01 | 2007-12-04 |
Continuous | 20292 | 83597 | M | 1985-01-01 | 2009-01-26 |
Continuous | 12041 | 375854 | M | 1982-01-01 | 2006-02-24 |
Continuous | 8446 | 201445 | M | 1989-01-01 | 2006-05-05 |
Continuous | 731321 | 374735 | M | 2001-03-30 | 2005-03-31 |
Continuous | 967 | 203016 | M | 1985-08-01 | 2003-11-06 |
Continuous | 32726 | 450230 | M | 1998-07-01 | 2007-07-11 |
Continuous | 20007 | 445338 | M | 1999-03-11 | 2005-11-01 |
Continuous | 33206 | 445338 | M | 1997-07-22 | 2002-12-02 |
Non-Continuous | 13266 | 377537 | M | 2008-01-11 | 2008-04-17 |
Non-Continuous | 13266 | 377537 | M | 2008-08-01 | 2008-12-11 |
A managers can be the manager of multiple companies, and I just want to exclude them in calculation if their ID repeat in one year for a unique company.
your help is appreciated.
Comment