Announcement

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

  • Panel data frame

    Hi am writing my thesis about the relationship between diversity and firm performance. I need to make a panel frame data frame.
    I want my data to looks like this:
    ISIN NAME ID Variable 1 Variable 2 Variable 3 Date Currency
    Company A A 1 x y z 1-1-2017 $
    Company A A 1 x y z 1-2-2017 $
    Company A A 1 x y z 1-3-2017 $
    Company B B 2 x y z 1-1-2017 $
    But my current dataset looks like this
    ISIN Name ID Currency Variable Date 1 Date 2 Date 3
    Company A A 1 $ Variable 1 x x x
    Company A A 1 $ Variable 2 y y y
    Company A A 1 $ Variable 3 z z z
    Company B B 2 $ Variable 1 x x x
    Where Date 1 is the name of the column and the label is 1-1-2017 and Date 2 = 1-2-2017

    Can someone please help me transform my data?

    Highly appreciated, thank you in advance!

  • #2
    I'm not sure what you are showing in #1. It cannot be a Stata data set because Stata variable names cannot contain spaces. Perhaps you are showing us what is in a spreadsheet or csv file? If so, you need to import the data into Stata first. See -help import excel- or -help import delimited- for that.

    Once you have the data imported into Stata, please post back, using the -dataex- command to show us what you actually will be working with. Without seeing more details of the data and metadata, it is not possible to give specific advice. While it is clear that the transformation you seek will involve a -reshape long- followed by another -reshape wide- command, the data probably will require some additional renaming or other modifications, the details of which cannot be discerned from what you have shown.

    If you are running version 18, 17, 16 or a fully updated version 15.1 or 14.2, -dataex- is already part of your official Stata installation. If not, run -ssc install dataex- to get it. Either way, run -help dataex- to read the simple instructions for using it. -dataex- will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.

    Comment

    Working...
    X