Announcement

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

  • Create board size and independence

    Hii Stata users,

    I would like to create two new variables: board size and board indenpendence. Therefore, I have retrieved for each company what type of board members are in the board (I, E or L).

    I already used
    Code:
    bysort CompanyName: gen BoardSize=_n
    And this is my data
    Code:
     
    IdentifierISS  BoardaffiliationEemployeeI BoardSize
    "0226152000" "I"  1
    "0226152000" "I"  2
    "0226152000" "L"  3
    "0226152000" "E"  4
    "0226152000" "I"  5
    "0226152000" "E"  6
    "0226152000" "I"  7
    "0226152000" "I"  8
    "00437V2004" "I"  1
    "00437V2004" "I"  2
    "00437V2004" "I"  3
    "00437V2004" "I"  4
    "00437V2004" "E"  5
    "00437V2004" "I"  6
    However, I would like to have a row with "Board Size = total number of board members" and a row with "Board Independence = amount I/board size" per company/IdentifierISS.

    Thank you in advance!



  • #2
    Rows and columns are found in matrices, tables and spreadsheets.

    It's clearer if you use Stata terminology for datasets on Statalist, namely observations and variables. I understand one thing, I think: you want an extra variable which could be

    Code:
     
     bysort CompanyName: gen TotalBoardSize = _N
    I didn't use the name BoardSize which you've already used for a variable that doesn't appear to be the board size at all.

    I don't understand what I E L mean at all and indeed what bearing they have on your question. Nor do I understand what board independence means.

    Statalist is interdisciplinary. Indeed of the top 20 or so contributors here perhaps 1 works with your kind of data, so if you don't get better answers you may need to descend to our level.

    Comment


    • #3
      Thank you Nick, that was exactly the command I was looking for to generate the variable board size.

      The other question what I was trying to ask is: how do I tell stata to create a new/extra variable which counts how many times a certain string observation occurs for a certain group.

      In my case for each company there are three different possible observations, I = indenpendent, E = Employee and L = Linked, I would like STATA to generate a new variable that counts "I" for the variable BoardaffiliationEemployeeI per CompanyName. So that afterwards I can generate a new variable Independence=Number I / Board Size.

      Code:
      input str46 CompanyName str1 BoardaffiliationEemployeeI float BoardSize
      "ALZA Corp"                     "E"  8
      "ALZA Corp"                     "L"  8
      "ALZA Corp"                     "I"  8
      "ALZA Corp"                     "I"  8
      "ALZA Corp"                     "I"  8
      "ALZA Corp"                     "I"  8
      "ALZA Corp"                     "E"  8
      "ALZA Corp"                     "I"  8
      "Accredo Health Inc"            "I"  8
      "Accredo Health Inc"            "I"  8
      "Accredo Health Inc"            "E"  8
      "Accredo Health Inc"            "I"  8
      "Accredo Health Inc"            "I"  8
      "Accredo Health Inc"            "I"  8
      "Accredo Health Inc"            "I"  8
      "Accredo Health Inc"            "I"  8
      "Advanced Fibre Communications" "I"  6
      "Advanced Fibre Communications" "I"  6
      "Advanced Fibre Communications" "I"  6
      "Advanced Fibre Communications" "I"  6
      "Advanced Fibre Communications" "E"  6
      "Advanced Fibre Communications" "I"  6
      "Agouron Pharmaceuticals Inc"   "E"  9
      "Agouron Pharmaceuticals Inc"   "I"  9
      "Agouron Pharmaceuticals Inc"   "E"  9
      "Agouron Pharmaceuticals Inc"   "I"  9
      "Agouron Pharmaceuticals Inc"   "I"  9
      "Agouron Pharmaceuticals Inc"   "I"  9
      "Agouron Pharmaceuticals Inc"   "I"  9
      "Agouron Pharmaceuticals Inc"   "I"  9
      "Agouron Pharmaceuticals Inc"   "I"  9
      "Allen Telecom Inc"             "L"  8
      "Allen Telecom Inc"             "E"  8
      "Allen Telecom Inc"             "I"  8
      "Allen Telecom Inc"             "I"  8
      "Allen Telecom Inc"             "I"  8
      "Allen Telecom Inc"             "L"  8
      "Allen Telecom Inc"             "I"  8
      "Allen Telecom Inc"             "I"  8

      Comment


      • #4
        https://www.statalist.org/forums/help#spelling

        Code:
        help egen
          
        bysort CompanyName: egen numberI = total(BoardaffiliationEemployeeI == "I")

        Comment

        Working...
        X