Announcement

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

  • Creating a new group variable in Panel Data

    Hi everyone!

    I was wondering if someone could lend a hand.

    I have panel data on firms board of directors. The panel is made up of observations of individual directors all of whom sit on the board of various firms.

    I am trying to create a new variable 'CEO_Duality_Firm'. CEO Duality occurs when a person holds both the role of chairman and CEO. I have created a binary variable, 'CEO_Duality_Individual', which shows when someone is both CEO and Chairman. Does anyone have any advice on what code I should run to create a new binary variable, 'CEO_Duality_Firm', which marks all members of a certain board either 1 or 0 depending on whether or not there is someone who is both CEO and Chairman in that year?

    For example, in 2008 for the firm "Kelda Group Ltd" there is not CEO Duality so in the new variable 'CEO_Duality_Firm' all members of the board for that year should be marked 0. In year 2009, for "Kelda Group Ltd" there is a CEO/Chairman, as indicated by the 'CEO_Duality_Individual' variable, so I want to mark all members of that firm in that year 1 in the new variable 'CEO_Duality_Firm'.

    I have attached a sample of my data below



    . dataex A D K CharacteristicsofRoles CEO_Duality_Individual

    ----------------------- copy starting from the next line -----------------------
    [CODE]
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str18 A str128 D str73 K str58 CharacteristicsofRoles float CEO_Duality_Firm


    "Mar 2008" "Kelda Group Ltd (Kelda Group plc prior to 07/2008)" "Stephen Bernard Lilley" "NED" 0
    "Mar 2008" "Kelda Group Ltd (Kelda Group plc prior to 07/2008)" "Kevin Ian Whiteman" "CEO" 0
    "Mar 2008" "Kelda Group Ltd (Kelda Group plc prior to 07/2008)" "John Alan Napier" "Chairman" 0
    "Mar 2008" "Kelda Group Ltd (Kelda Group plc prior to 07/2008)" "John George Duthie-Jackson" "NED" 0
    "Mar 2008" "Kelda Group Ltd (Kelda Group plc prior to 07/2008)" "Richard John Cole" "NED" 0
    "Mar 2008" "Kelda Group Ltd (Kelda Group plc prior to 07/2008)" "Stuart Harvey Baldwin" "NED" 0
    "Mar 2008" "Kelda Group Ltd (Kelda Group plc prior to 07/2008)" "Allison Margaret Bainbridge" "GFD" 0
    "Mar 2009" "Kelda Group Ltd (Kelda Group plc prior to 07/2008)" "Allison Margaret Bainbridge" "GFD" 0
    "Mar 2009" "Kelda Group Ltd (Kelda Group plc prior to 07/2008)" "Stuart Douglas McFarlane" "Company Secretary" 0
    "Mar 2009" "Kelda Group Ltd (Kelda Group plc prior to 07/2008)" "Kevin Ian Whiteman" "Chairman/CEO" 1


  • #2
    Code:
    egen wanted = max(Characteristics == "Chairman/CEO"),  by(A D)
    See also https://www.stata.com/support/faqs/d...ble-recording/

    Trivium: In marking-up code note that you need to copy and paste both CODE and /CODE with surrounding square brackets for the mark-up to work. Also, the line


    ----------------------- copy starting from the next line -----------------------

    was intended to explain itself!

    Comment


    • #3
      Thanks v much for your help, Nick

      Comment

      Working...
      X