Announcement

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

  • How to unpivot columns to create panel data?

    Hi all,

    In Excel, i'd usually use power query to unpivot columns and then copy the data into stata, however, i'm working with daily stock return data over a 25 year period, so Excel is unable to unpivot this much data. I understand that I could potentially do this on stata by using the reshape command to convert the data from wide to long, but i'm unsure how?

    Apologies that i'm not really sure how to use dataex, but my data has company names in the top row, and the left hand column is a list of dates. My aim is to go from something like:

    Company A Company B
    31/12/2019 0.05 0.04
    30/12/2019 0.05 0.04


    To

    Company A 31/12/2019 0.05
    Company A 30/12/2019 0.05
    Company B 31/12/2019 0.04
    Company B 30/12/2019 0.04

    I have to do this for a large number of dates and company names, so any advice would be greatly appreciated!

  • #2
    Code:
    help reshape long

    Comment


    • #3
      And for instruction on using dataex to provide an example of your data that can be used to to demonstrate the use of reshape long on your data, rather than have to write an essay about something like your data, see
      Code:
      help dataex

      Comment

      Working...
      X