Announcement

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

  • Issue with counting the number of Senior Management (TMT) and Board members in firm using tag

    Dear members,

    I have been trying to figure out the correct syntax for my issue but to no avail.
    I have a dataset with multiple firms and team members (identified using BvdIdNumber (firmid) and DMUci (personid)).
    I also created some variables called SenMan and Board (dummies) to see based on the string variable TypeRole whether the person is part of the senior management (TMT) or board (BoD) or both (I looked whether they contained the word Board and SenMan).
    Additionally, I have created a variable to determine whether the person is unique within the company using tag(BvdIdNumber DMUci).

    However, a person can be in the dataset multiple times but one observation may say they are in the board and the next might say they are part of the senior management (both are true).
    I used the following code first to try to create three new variables, namely TMTpercompany, BoDpercompany and TMT_BoDpercompany which should check how many members of each are present for a firm.

    Code:
    bysort BvdIdNumber: egen TMTpercompany = total(distinctUCI) if SenMan == 1
    bysort BvdIdNumber (TMTpercompany) : replace TMTpercompany= TMTpercompany[_n-1] if missing(TMTpercompany) 
    
    bysort BvdIdNumber: egen BoDpercompany = total(distinctUCI) if Board== 1
    bysort BvdIdNumber (BoDpercompany) : replace BoDpercompany= BoDpercompany[_n-1] if missing(BoDpercompany)
    
    bysort BvdIdNumber: egen TMT_BoDpercompany = total(distinctUCI) if SenMan == 1 | Board== 1
    bysort BvdIdNumber (TMT_BoDpercompany) : replace TMT_BoDpercompany= TMT_BoDpercompany[_n-1] if missing(TMT_BoDpercompany)

    However (a bit as expected) this would not always generate the correct result since it only indicates a 1 for one of the observations of the individual which might be the one where they are stated as senior management.
    But, it then disregards the next observation of that individual which might state they are part of the board (since the dummy = 0)).

    I then tried creating a variable using tag( BvdIdNumber DMUci TypeRole) but that also did not give the desired result.
    I added an example using dataex below with the original variables and the ones I created + the results of the code after using tag( BvdIdNumber DMUci TypeRole). I used anonymized ID's using the new variables BvdIdNumber2 & DMUci2.

    Thanks in advance!
    Best regards,
    Laura


    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(BvdIdNumber2 DMUci2) byte(SenMan Board distinctuci distinctBVD_UCI_ROLE) float(TMTpercompany BoDpercompany TMT_BoDpercompany)
    15260  943129 1 0 0 0 2 1 3
    15260  943129 1 0 0 1 2 1 3
    15260  943129 0 1 0 1 2 1 3
    15260  943129 1 0 1 0 2 1 3
    15260 1007251 1 0 1 1 2 1 3
    15261    1459 0 1 1 1 1 2 2
    15261  694631 1 1 1 1 1 2 2
    15262  476063 1 1 1 1 1 1 1
    15263  626434 1 0 1 1 3 . 3
    15263 1008172 1 0 1 1 3 . 3
    15263 1008543 1 0 1 1 3 . 3
    15264  653207 1 0 1 1 2 . 2
    15264  596645 1 0 1 1 2 . 2
    15265  581619 1 0 1 1 1 . 1
    15266  754631 1 0 1 1 5 4 7
    15266  365267 1 0 1 1 5 4 7
    15266  160481 1 1 0 1 5 4 7
    15266  160481 1 1 1 0 5 4 7
    15266  249528 0 1 0 1 5 4 7
    15266  471543 1 0 1 1 5 4 7
    15266  857349 0 1 1 1 5 4 7
    15266  249528 1 1 1 1 5 4 7
    15266  249528 1 1 0 0 5 4 7
    15267  742279 1 1 1 1 5 2 5
    15267  657157 1 0 1 1 5 2 5
    15267  742279 1 0 0 1 5 2 5
    15267  931618 1 0 0 0 5 2 5
    15267  742279 1 1 0 1 5 2 5
    15267  657157 1 0 0 0 5 2 5
    15267  931618 1 0 1 1 5 2 5
    15268  682720 1 0 1 1 1 . 1
    15269  694630 1 0 1 1 2 1 2
    15269  350123 1 1 1 1 2 1 2
    15270  502102 1 0 1 1 3 1 3
    15270  502102 1 1 0 1 3 1 3
    15270  348714 1 0 1 1 3 1 3
    15270  502102 1 0 0 0 3 1 3
    end

  • #2
    Laura,

    I am having trouble figuring out what you hope to end up with. I can't figure out what the variables other than Bcd*, DMU*, SenMan and Board are supposed to indicate. Here are the variables for firm 15266 I do understand:

    Code:
        BvdIdN~2   DMUci2   SenMan   Board  
           15266   160481        1       1       
           15266   160481        1       1        
           15266   249528        0       1        
           15266   249528        1       1       
           15266   249528        1       1         
           15266   365267        1       0        
           15266   471543        1       0      
           15266   754631        1       0       
           15266   857349        0       1
    Do you want a dataset with a single observation for each firm/person pair, indicating whether they are both senior management and board member? So for firm 15266, the following?

    Code:
        BvdIdN~2   DMUci2   SenMan   Board  
           15266   160481        1       1      
           15266   249528        1       1         
           15266   365267        1       0        
           15266   471543        1       0      
           15266   754631        1       0       
           15266   857349        0       1
    Devra Golbe
    Professor Emerita, Dept. of Economics
    Hunter College, CUNY

    Comment


    • #3
      Devra Golbe, Thank you for your reply, and sorry my post wasn't very clear.
      I am trying to get a variable that counts the total number of senior managers, the total number of board members and the combined total number per firm.

      I created The distintuci variable since I didn't want to double count people based on the same DMUci (person identifier). However, this is not ideal as they might have different information (for example: one observation states they are a senior manager and the next states they are a board member, but both observations are correct so they are both a board and senior manager). So I thought creating a distinctBVD_UCI_ROLE
      variable (code: tag(BvdIdNumber DMUci TypeRole) would solve this issue but it did not. The other three variables are variables I created with the above mentioned code using the distinctBVD_UCI_ROLE variable, but it would give me the intended output.

      In the example you gave for company 15266 the intended output would be

      Code:
      BvdIdNumber         DMUci      SenMan    Board    TotalSenMan    TotalBoard   TotalSenMan_Board
      15266               160481       1        1             5             3              6
      15266               249528       1        1             5             3              6
      15266               365267       1        0             5             3              6
      15266               471543       1        0             5             3              6
      15266               754631       1        0             5             3              6
      15266               857349       0        1             5             3              6
      However, if possible I would rather not delete any observations at this point, but indeed as seen for DMUci 249528, they appear 3 times, in one of them they are mentioned as only a board member but according to the two other observations they are also part of the senior management. So the output would be as follows:

      Code:
      BvdIdNumber        DMUci      SenMan    Board    TotalSenMan    TotalBoard   TotalSenMan_Board
      15266               754631       1       0             5            3                   6
      15266               365267       1       0             5            3                   6
      15266               160481       1       1             5            3                   6
      15266               160481       1       1             5            3                   6
      15266               249528       0       1             5            3                   6
      15266               471543       1       0             5            3                   6
      15266               857349       0       1             5            3                   6
      15266               249528       1       1             5            3                   6
      15266               249528       1       1             5            3                   6

      An issue I encountered earlier when trying to figure out the syntax is that sometimes, if the formula did not apply to the observation (for example for the first observation of DMUci 249528 which has a 0 for SenMan, it would output a missing (.) instead of the total per company, which I am trying to avoid.).

      Thanks in advance for your help!
      Laura
      Last edited by Laura Hill; 23 Sep 2024, 07:08.

      Comment


      • #4
        Using the data posted above, try this:

        Code:
        drop distinct* TMT* BoD
        *save original data to merge back later
        tempfile dat1
        save `dat1'
        
        bysort Bvd DMU: egen maxSen=max(SenMan)
        bysort Bvd DMU: egen maxBoard=max(Board)
        
        duplicates drop Bvd DMU, force
        
        bysort Bvd : egen TotalSen=total(maxSen)
        bysort Bvd : egen TotalBoard=total(maxBoard)
        bysort Bvd: egen TotalSenMan_Board=count(DMU)
        
        drop maxSen maxBoard
        
        *merge back original data so you keep all observations
        merge 1:m Bvd DMU using `dat1', nogenerate
        list if Bvd==15266,  noobs clean
        Result:
        Code:
            BvdIdN~2   DMUci2   SenMan   Board   TotalSen   TotalB~d   TotalS~d  
               15266   160481        1       1          5          3          6  
               15266   249528        1       1          5          3          6  
               15266   365267        1       0          5          3          6  
               15266   471543        1       0          5          3          6  
               15266   754631        1       0          5          3          6  
               15266   857349        0       1          5          3          6  
               15266   160481        1       1          5          3          6  
               15266   249528        1       1          5          3          6  
               15266   249528        1       1          5          3          6
        You'll have to check what happens if you have any firm/person pairs where both SenMan and Board are always zero.
        Devra Golbe
        Professor Emerita, Dept. of Economics
        Hunter College, CUNY

        Comment


        • #5
          Hello Laura,

          I'm a little confused too. In your question you talk about a company ID called BvdldNumber and a personID called DMUci, but in the example data you have BvldldNumber2 and DMUci2. If I understood you correctly, you generated all variables yourself except these two.
          I also don't understand where the duplicates in your data regarding these two variables come from. If you could instead take a few steps back and post a snippet of your raw data (including the original id variables and the TypeRole variable), things might become a little clearer for me.
          I am very sure that there is a not-so-complicated way to determine the number of senior members and board members for these firms but unfortunately I cannot help you with the current information.

          Comment


          • #6
            Devra Golbe, thank you so much for the code, it seems to have given me almost the expected output. However, indeed when an observation states they are neither part of the senior management and the board, they are still counted in the TotalSenMan_Board variable. This makes sense though since it based on the DMUci variable (some people are employees such as assistants, but not part of senior management or board). However, I could remove these individuals before the code so I believe this would remedy the issue.
            See below the output examples

            Code:
            * Example generated by -dataex-. To install: ssc install dataex
            clear
            input float(BvdIdNumber2 DMUci2) str28 DMTypeRole byte(SenMan Board) float(TotalSen TotalBoard TotalSenMan_Board)
            727628 374657 "OthDep" 0 0 1 0 3
            727628 403773 "SenMan" 1 0 1 0 3
            727628 403773 "SenMan" 1 0 1 0 3
            727628 989055 "OthDep" 0 0 1 0 3
            end

            Benno Schoenberger, thank you for your post. Unfortunately, I cannot share the original data, but the BvdIdNumber2 and DMUci2 are anonymized versions of the original variables (using the group command).
            These two variables indeed are original variables (except for the anonymization). I didn't add it in the dataex file but I created the dummy variables SenMan and Board from the string variable DMTypeRole which contains the role of the person (eg.: SenMan = senior management, BoD/AdvB... = board).
            The duplicates in the data come from the company register databases from which information is taken. Therefore, there are differences in what roles they have and they differ on other information as well (for example.: appointment date, date of information updated, etc.). So it could be that at time A the person was only a senior manager but at time B became a board member as well. At this point in time I cannot delete duplicates on this information as I would need the other variables in my dataset as well.

            Code:
            * Example generated by -dataex-. To install: ssc install dataex
            clear
            input float(BvdIdNumber2 DMUci2) str28 DMTypeRole byte(SenMan Board)
            193 154703 "SenMan" 1 0
            193 158059 "SenMan" 1 0
            193 167690 "SenMan" 1 0
            193 167690 "SenMan" 1 0
            193 263970 "Proxy"  0 0
            193 263970 "Proxy"  0 0
            193 263970 "Proxy"  0 0
            193 263970 "Proxy"  0 0
            193 413897 "SenMan" 1 0
            193 413897 "SenMan" 1 0
            193 647995 "SenMan" 1 0
            193 647995 "SenMan" 1 0
            193 762524 "Proxy"  0 0
            193 921245 "Proxy"  0 0
            193 976719 "SenMan" 1 0
            193 976719 "SenMan" 1 0
            686630 141280 "BoD"    0 1
            686630 342394 "OthDep" 0 0
            686630 342394 "OthDep" 0 0
            686630 342394 "OthDep" 0 0
            686630 342394 "OthDep" 0 0
            686630 342394 "OthDep" 0 0
            686630 900705 "BoD"    0 1
            681936 129388 "OthDep" 0 0
            681936 141805 "AdvB"   0 1
            681936 142108 "Proxy"  0 0
            681936 334554 "AudC"   0 0
            681936 337491 "AudC"   0 0
            681936 343170 "AudC"   0 0
            681936 344398 "AudC"   0 0
            681936 368951 "AudC"   0 0
            681936 368951 "AudC"   0 0
            681936 368951 "AudC"   0 0
            681936 555326 "AdvB"   0 1
            681936 555326 "AdvB"   0 1
            681936 555326 "AdvB"   0 1
            681936 555328 "AudC"   0 0
            681936 555328 "AudC"   0 0
            681936 555375 "AudC"   0 0
            681936 566791 "AudC"   0 0
            681936 600323 "AudC"   0 0
            681936 600323 "AudC"   0 0
            681936 602169 "AudC"   0 0
            681936 602169 "AudC"   0 0
            681936 602170 "AudC"   0 0
            681936 602170 "AudC"   0 0
            681936 602283 "AudC"   0 0
            681936 602543 "AudC"   0 0
            681936 652829 "OthDep" 0 0
            681936 652829 "OthDep" 0 0
            681936 652829 "OthDep" 0 0
            681936 652829 "OthDep" 0 0
            681936 652829 "OthDep" 0 0
            681936 652829 "OthDep" 0 0
            681936 652830 "SenMan" 1 0
            681936 652830 "SenMan" 1 0
            681936 672404 "AudC"   0 0
            681936 751842 "AudC"   0 0
            681936 751842 "AudC"   0 0
            end
            
            end
            Below a dataex example with the DMTypeRole variable included and the dummy SenMan and Board variables that I created. To avoid confusion I have not added the other variables I initially created to try to figure out the syntax. I also made sure to include companies in which there are people who are not part of the board or the senior management for illustration purposes.

            Thanks for your advice, I'll take it into account in next posts!
            Best regards,
            Laura

            Comment


            • #7
              Does this do it?

              Code:
              tempfile dat1
              save `dat1'
              
              bysort Bvd DMU: egen maxSen=max(SenMan)
              bysort Bvd DMU: egen maxBoard=max(Board)
              
              duplicates drop Bvd DMU, force
              
              bysort Bvd : egen TotalSen=total(maxSen)
              bysort Bvd : egen TotalBoard=total(maxBoard)
              gen SenOrBd=0
              bysort Bvd: replace SenOrBd=1 if maxSen>0 |maxBoard>0
              bysort Bvd: egen  x=count(SenOrBd) if SenOrBd>0
              by Bvd: mipolate x DMUc, gen(TotalSenMan_Board) groupwise
              
              
              drop maxSen maxBoard x
              
              *merge back original data so you keep all observations
              merge 1:m Bvd DMU using `dat1', nogenerate
              
              sort Bvd DMU
              list if Bvd==681936,  noobs
              Note that you will need to install Nick Cox's mipolate via ssc install.
              Last edited by Devra Golbe; 23 Sep 2024, 11:23.
              Devra Golbe
              Professor Emerita, Dept. of Economics
              Hunter College, CUNY

              Comment


              • #8
                Devra Golbe, thank you for your help. Unfortunately this code does not give the intended output.
                Using this company as an example there is 1 unique SenMan members (UCI =652830) , 2 unique board members (UCI =141805 and 555326 ) and 3 unique members who are either/and in the SenMan or Board.

                See below output for Bvd == 681936
                Code:
                * Example generated by -dataex-. To install: ssc install dataex
                clear
                input float(BvdIdNumber2 DMUci2) str28 DMTypeRole byte(SenMan Board) float(maxSen maxBoard TotalSen TotalBoard SenOrBd)
                681936 129388 "OthDep" 0 0 0 0 2 4 0
                681936 141805 "AdvB"   0 1 0 1 2 4 0
                681936 142108 "Proxy"  0 0 0 0 2 4 0
                681936 334554 "AudC"   0 0 0 0 2 4 0
                681936 337491 "AudC"   0 0 0 0 2 4 0
                681936 343170 "AudC"   0 0 0 0 2 4 0
                681936 344398 "AudC"   0 0 0 0 2 4 0
                681936 368951 "AudC"   0 0 0 0 2 4 0
                681936 368951 "AudC"   0 0 0 0 2 4 0
                681936 368951 "AudC"   0 0 0 0 2 4 0
                681936 555326 "AdvB"   0 1 0 1 2 4 0
                681936 555326 "AdvB"   0 1 0 1 2 4 0
                681936 555326 "AdvB"   0 1 0 1 2 4 0
                681936 555328 "AudC"   0 0 0 0 2 4 0
                681936 555328 "AudC"   0 0 0 0 2 4 0
                681936 555375 "AudC"   0 0 0 0 2 4 0
                681936 566791 "AudC"   0 0 0 0 2 4 0
                681936 600323 "AudC"   0 0 0 0 2 4 0
                681936 600323 "AudC"   0 0 0 0 2 4 0
                681936 602169 "AudC"   0 0 0 0 2 4 0
                681936 602169 "AudC"   0 0 0 0 2 4 0
                681936 602170 "AudC"   0 0 0 0 2 4 0
                681936 602170 "AudC"   0 0 0 0 2 4 0
                681936 602283 "AudC"   0 0 0 0 2 4 0
                681936 602543 "AudC"   0 0 0 0 2 4 0
                681936 652829 "OthDep" 0 0 0 0 2 4 0
                681936 652829 "OthDep" 0 0 0 0 2 4 0
                681936 652829 "OthDep" 0 0 0 0 2 4 0
                681936 652829 "OthDep" 0 0 0 0 2 4 0
                681936 652829 "OthDep" 0 0 0 0 2 4 0
                681936 652829 "OthDep" 0 0 0 0 2 4 0
                681936 652830 "SenMan" 1 0 1 0 2 4 0
                681936 652830 "SenMan" 1 0 1 0 2 4 0
                681936 672404 "AudC"   0 0 0 0 2 4 0
                681936 751842 "AudC"   0 0 0 0 2 4 0
                681936 751842 "AudC"   0 0 0 0 2 4 0
                end
                Best regards,
                Laura

                Comment


                • #9
                  Maybe I made a mistake somewhere, but when I run the code in #7 on the data in #6 this is what I see:
                  1 for TotalSen, 2 for TotalBoard, & 3 for TotalSenMan_Board. Did I miss something?

                  Code:
                   list if Bvd==681936,  noobs
                  
                    +------------------------------------------------------------------------------------------+
                    | BvdIdN~2   DMUci2   DMType~e   SenMan   Board   TotalSen   TotalB~d   SenOrBd   TotalS~d |
                    |------------------------------------------------------------------------------------------|
                    |   681936   129388     OthDep        0       0          1          2         0          3 |
                    |   681936   141805       AdvB        0       1          1          2         1          3 |
                    |   681936   142108      Proxy        0       0          1          2         0          3 |
                    |   681936   334554       AudC        0       0          1          2         0          3 |
                    |   681936   337491       AudC        0       0          1          2         0          3 |
                    |------------------------------------------------------------------------------------------|
                    |   681936   343170       AudC        0       0          1          2         0          3 |
                    |   681936   344398       AudC        0       0          1          2         0          3 |
                    |   681936   368951       AudC        0       0          1          2         0          3 |
                    |   681936   368951       AudC        0       0          1          2         0          3 |
                    |   681936   368951       AudC        0       0          1          2         0          3 |
                    |------------------------------------------------------------------------------------------|
                    |   681936   555326       AdvB        0       1          1          2         1          3 |
                    |   681936   555326       AdvB        0       1          1          2         1          3 |
                    |   681936   555326       AdvB        0       1          1          2         1          3 |
                    |   681936   555328       AudC        0       0          1          2         0          3 |
                    |   681936   555328       AudC        0       0          1          2         0          3 |
                    |------------------------------------------------------------------------------------------|
                    |   681936   555375       AudC        0       0          1          2         0          3 |
                    |   681936   566791       AudC        0       0          1          2         0          3 |
                    |   681936   600323       AudC        0       0          1          2         0          3 |
                    |   681936   600323       AudC        0       0          1          2         0          3 |
                    |   681936   602169       AudC        0       0          1          2         0          3 |
                    |------------------------------------------------------------------------------------------|
                    |   681936   602169       AudC        0       0          1          2         0          3 |
                    |   681936   602170       AudC        0       0          1          2         0          3 |
                    |   681936   602170       AudC        0       0          1          2         0          3 |
                    |   681936   602283       AudC        0       0          1          2         0          3 |
                    |   681936   602543       AudC        0       0          1          2         0          3 |
                    |------------------------------------------------------------------------------------------|
                    |   681936   652829     OthDep        0       0          1          2         0          3 |
                    |   681936   652829     OthDep        0       0          1          2         0          3 |
                    |   681936   652829     OthDep        0       0          1          2         0          3 |
                    |   681936   652829     OthDep        0       0          1          2         0          3 |
                    |   681936   652829     OthDep        0       0          1          2         0          3 |
                    |------------------------------------------------------------------------------------------|
                    |   681936   652829     OthDep        0       0          1          2         0          3 |
                    |   681936   652830     SenMan        1       0          1          2         1          3 |
                    |   681936   652830     SenMan        1       0          1          2         1          3 |
                    |   681936   672404       AudC        0       0          1          2         0          3 |
                    |   681936   751842       AudC        0       0          1          2         0          3 |
                    |------------------------------------------------------------------------------------------|
                    |   681936   751842       AudC        0       0          1          2         0          3 |
                    +------------------------------------------------------------------------------------------+
                  Devra Golbe
                  Professor Emerita, Dept. of Economics
                  Hunter College, CUNY

                  Comment


                  • #10
                    Devra Golbe, my apologies I reran the code line per line and I must have made a mistake last time when copying the code.
                    The code seems to work perfectly (I checked for a couple of random companies).

                    Thank you so much for your help!

                    Best regards,
                    Laura

                    Comment


                    • #11
                      You're welcome! Could just as easily have been my mistake.
                      Devra Golbe
                      Professor Emerita, Dept. of Economics
                      Hunter College, CUNY

                      Comment

                      Working...
                      X