Announcement

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

  • How to use reshape long to create panel data set

    Hi, I want to ask how to use reshape long command to convert three different cross-sectional data into a single column for panel data?
    Below is my code
    Code:
    reshape long SP500 DowJones NASDAQ100, i(ym) j(unit)
    Here is the data set:
    Click image for larger version

Name:	19a8874697480b7c3e32a6f111dcda7.png
Views:	1
Size:	49.6 KB
ID:	1767751



    Many Thanks,
    Last edited by Tin Cheng; 16 Nov 2024, 18:09.

  • #2
    Code:
    rename (SP500-M20) value=
    reshape long value, i(ym) j(unit)
    In the future, when showing data examples, please use the -dataex- command to do so. 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


    • #3
      Thank you for the recommendation! Next time I will try to use -dataex- command to display data example.

      Comment


      • #4
        You're welcome. However, looking at what I wrote in #2, I realize that there is an error. It should be:
        Code:
        rename (SP500-M20) value=
        reshape long value, i(ym) j(unit) string
        Sorry about that!

        Comment

        Working...
        X