Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    OK, I think I get it. Being a team is starting together at the same firm (but it is not their first job) after being previously employed at a (different) same firm. So I think this will do it:

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear*
    input long(gvkey1 execid2) double year
    1004 33979 2007
    1004 33979 2008
    1004 33979 2009
    1004 33979 2010
    1004 33979 2011
    1004 33979 2012
    1004 46404 2009
    1004 46404 2010
    1004 46404 2011
    1045 46192 2012
    1056 1891 2006
    1056 1891 2007
    1056 1891 2008
    1056 12755 2008
    1056 12755 2009
    1056 12755 2010
    1056 13000 2008
    1056 13000 2009
    1056 13000 2010
    1056 13000 2011
    1080 12755 2011
    1080 12755 2012
    1080 12755 2013
    1080 13000 2012
    1080 13000 2013
    1080 13000 2014
    1100 33979 2013
    1100 33979 2014
    1100 33979 2015
    1100 33979 2016
    1100 33979 2017
    1100 33979 2018
    1100 46404 2013
    1100 46404 2014
    1100 46404 2015
    1100 46192 2016
    1111 22978 2006
    1111 22978 2007
    1111 22978 2008
    1111 32091 2006
    1111 32091 2007
    1111 32091 2008
    1161 37980 2009
    1161 37980 2010
    1161 37980 2011
    1161 37980 2012
    1161 40775 2010
    1161 40775 2011
    1161 40775 2012
    1161 42390 2011
    1161 42390 2012
    1161 42390 2013
    1161 42390 2014   
    27119 46404 2014
    27119 46404 2015
    27119 46404 2016
    27119 46404 2017    
    27119 46404 2018  
    27119 46404 2019   
    181104 33979 2013       
    181104 33979 2014   
    181104 33979 2015
    181104 33979 2015
    181104 33979 2016
    181104 33979 2017     
    181104 33979 2018       
    181104 33979 2019
    
    end
    
    //  CREATE SPELLS OF CONSECUTIVE EMPLOYMENT AT A SINGLE FIRM FOR EACH EXECUTIVE
    frame put gvkey1 execid2 year, into(working)
    frame change working
    by execid2 (gvkey1 year), sort: gen spell = sum(gvkey1 != gvkey1[_n-1] ///
        | year != year[_n-1] + 1)
    
    //  CHARACTERIZE EACH SPELL BY ITS START, FINISH, AND ANTECEDENT
    //  AND SUBSEQUENT EMPLOYERS
    by execid2 spell (year), sort: gen start = year[1]
    by execid2 spell (year): gen finish = year[_N]
    by execid2 (spell year): gen previous = gvkey[_n-1] if spell != spell[_n-1]
    by execid2 (spell year): gen subsequent = gvkey[_n+1] if spell != spell[_n+1]
    by execid2 spell (year): replace subsequent = subsequent[_N]
    by execid2 spell (year): keep if _n == 1
    drop spell year
    
    //  NOW IDENTIFY SPELLS THAT HAVE THE SAME EMPLOYER, START, FINISH,
    //  AND ANTECEDENT EMPLOYER FOR MORE THAN ONE EXEC
    by gvkey1 start previous, sort: keep if _N > 1 & !missing(previous)
    
    //  RETAIN THE INFORMATION ON PARALLEL TRANSFERS IN FRAME WORKING
    //  AND CREATE A SEPARATE FRAME FOR JUST THE EXECID'S INVOLVED
    frame put execid2, into(execs_to_drop)
    frame execs_to_drop: duplicates drop
    
    //  BACK TO THE ORIGINAL DATA
    frame change default
    frlink m:1 execid2, frame(execs_to_drop)
    drop if !missing(execs_to_drop)

    Comment


    • #17
      "OK, I think I get it.

      Being a team is starting together at the same firm after being previously employed at a (different) same firm". This is correct!

      There is only one thing important to add. Going to the next firm should happen for both executives in the same year. So it is all about the time (year) the change takes place.

      Comment


      • #18
        There is only one thing important to add. Going to the next firm should happen for both executives in the same year. So it is all about the time (year) the change takes place.
        The code in #16 gets that.

        Comment


        • #19
          Thanks Clyde! I will check it in the morning!

          Comment


          • #20
            Thanks Clyde!

            I have one final different question.

            I also would like to know if there are teams of executives starting and finish working in exactly the same years in the first company. Subsequently, they are going to work together (as a team) starting in exactly the same years for the second company and also finish working at this company.

            Summarizing:
            - Start / Finish at the first company is for team of executives equal (e.g. Executive 1 and Executive 2 both start working in "2011" and finish their first job in "2014").
            - Moving to the second company for team of executives is in exactly the same year (as you did previously in #16) both equal (e.g. both start working for their second company in "2015")
            - Start / Finish at the second company is for team of executives equal (e.g. Executive 1 and Executive 2 both start working in "2015" for their second company and finish working in "2019")

            I understand that this teams are removed in the code in #16.
            Last edited by Jarno Stappers; 08 Jan 2021, 04:58.

            Comment


            • #21
              I believe this will do it:

              Code:
              //  CREATE SPELLS OF CONSECUTIVE EMPLOYMENT AT A SINGLE FIRM FOR EACH EXECUTIVE
              frame put gvkey1 execid2 year, into(working)
              frame change working
              by execid2 (gvkey1 year), sort: gen spell = sum(gvkey1 != gvkey1[_n-1] ///
                  | year != year[_n-1] + 1)
              
              //  CHARACTERIZE EACH SPELL BY ITS START, FINISH, AND ANTECEDENT
              //  AND SUBSEQUENT EMPLOYERS
              by execid2 spell (year), sort: gen start = year[1]
              by execid2 spell (year): gen finish = year[_N]
              by execid2 (spell year): gen previous = gvkey[_n-1] if spell != spell[_n-1]
              by execid2 (spell year): gen previous_start = start[_n-1] if spell != spell[_n-1]
              by execid2 (spell year): gen previous_finish = finish[_n-1] if spell != spell[_n-1]
              by execid2 (spell year): gen subsequent = gvkey[_n+1] if spell != spell[_n+1]
              by execid2 spell (year): replace subsequent = subsequent[_N]
              by execid2 spell (year): keep if _n == 1
              drop spell year
              
              //  NOW IDENTIFY SPELLS THAT HAVE THE SAME EMPLOYER, START, FINISH,
              //  AND ANTECEDENT EMPLOYER FOR MORE THAN ONE EXEC
              by gvkey1 start finish previous previous_start previous_finish, sort: ///
                  keep if _N > 1 & !missing(previous, gvkey1)
              
              //  RETAIN THE INFORMATION ON PARALLEL TRANSFERS IN FRAME WORKING
              //  AND CREATE A SEPARATE FRAME FOR JUST THE EXECID'S INVOLVED
              frame put execid2, into(execs_to_drop)
              frame execs_to_drop: duplicates drop
              
              //  BACK TO THE ORIGINAL DATA
              frame change default
              frlink m:1 execid2, frame(execs_to_drop)
              drop if !missing(execs_to_drop)

              Comment


              • #22
                Thanks Clyde!

                The code works fine!

                Comment

                Working...
                X