Announcement

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

  • Convert columns to rows. From Spell to Panal Data

    I would like to switch columns to rows. I want each bank in each time period to be an own observation -> so a panal data set. (See the example switching Ratings and Banks)

    Click image for larger version

Name:	Bildschirmfoto 2022-06-17 um 10.36.28.png
Views:	1
Size:	87.4 KB
ID:	1669630

  • #2
    What I can tell you is that you will want to start with reshape long to create the Bank variable, and then reshape wide to place the Ratings into separate columns.

    Beyond that, I can't give example code because you didn't provide an example of your actual data.

    Descriptions of data are well-meant but insufficient to help those who want to help you. Even the best descriptions of data are no substitute for an actual example of the data. There are many ways your data might be organized that are consistent with your description, and each would require a somewhat different approach. In order to get a helpful response, you need to show some example data.

    Be sure to use the dataex command to do this. If you are running version 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 and 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