Announcement

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

  • Reshaping from long to wide with multiple variables

    Hi,

    I'm trying to reshape my data into a panel by company ID (cusip) for the given years, so I have to change the board member observations to variables. Each director variable is supposed to have data on each of the years per firm. 'Reshape wide directorid, i(cusip) j(year)' gives a 'values of variable year not unique within cusip' error, which I don't understand because each directorid is unique for every year within a firm. An excerpt of my data is seen below as well as what it is supposed to look like afterwards. Would be great if anyone could help me with this.


    rowtype boardname rolename directorid totcurrnolstdbrd annualreportdate totalcompensation isin numberdirectors cusip year
    Board Member AK STEEL HOLDING CORP Independent Director 28729 4 01dec2000 19 US0015471081 9 001547108 2000
    Board Member AK STEEL HOLDING CORP Independent Director 28729 4 01dec2001 19 US0015471081 9 001547108 2001
    Board Member AK STEEL HOLDING CORP Independent Director 28729 6 01dec2002 20 US0015471081 10 001547108 2002
    Board Member AK STEEL HOLDING CORP Independent Director 28729 7 01dec2003 20 US0015471081 9 001547108 2003
    Board Member AK STEEL HOLDING CORP Independent Director 28729 6 01dec2004 35 US0015471081 9 001547108 2004
    Board Member AK STEEL HOLDING CORP Independent Director 28729 6 01dec2005 40 US0015471081 9 001547108 2005
    Board Member AK STEEL HOLDING CORP Independent Director 32007 6 01dec2000 19 US0015471081 9 001547108 2000
    Board Member AK STEEL HOLDING CORP Independent Director 32007 6 01dec2001 19 US0015471081 9 001547108 2001
    Board Member AK STEEL HOLDING CORP Independent Director 32007 6 01dec2002 20 US0015471081 10 001547108 2002
    Board Member AK STEEL HOLDING CORP Independent Director 32007 6 01dec2003 20 US0015471081 9 001547108 2003
    Board Member AK STEEL HOLDING CORP Independent Director 32007 5 01dec2004 35 US0015471081 9 001547108 2004
    Board Member AK STEEL HOLDING CORP Independent Director 32007 4 01dec2005 40 US0015471081 9 001547108 2005


    cusip year director1 totalcompensation1 director2 totalcompensation2 director3 totalcompensation3 director4 totalcompensation4 etc..
    001547108 2000 28729 19
    001547108 2001 28729 19
    001547108 2002 28729 20
    001547108 2003 28729 20
    001547108 2004 28729 35
    001547108 2005 28729 40

    Kind regards,
    Luuc

  • #2
    Welcome to the Stata Forum / Statalist,

    Please read the FAQ. There you'll find how to share data/command/output. Thanks.

    The data set is apparently in the long form. You wish to perform a panel data analysis, hence the long form is the appropriate strategy: no need to reshape wide. Finally, the data set shows data in the long form, but the variable "totalcompensation" is the wide form. If you want to underline the sequence of the values BY cusip, the command - egen - is the one to look for.
    Best regards,

    Marcos

    Comment


    • #3
      Thanks for your reply. Realised I only need to merge one or two variables that are already in correct form.

      Comment

      Working...
      X