Announcement

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

  • Importing data when variables names are numeric

    Hello,

    I am dealing with a large umber of .txt files with this format:

    1980 1981 1982 1983
    1 region1 0.2 0.3 0.15 0.17
    2 region2 0.1 0.25 0.13 0.11
    3 region3 0.01 0.21 0.24 0.13

    (note: years and regions might not be regular for all the files, this is just a made up sample).


    Ideally, I would like the import into Stata to look like:

    y1980 y1981 y1982 y1983
    1 region1 0.2 0.3 0.15 0.17
    2 region2 0.1 0.25 0.13 0.11
    3 region3 0.01 0.21 0.24 0.13

    so that the first row is imported as variable names and then reshaping long to obtain the panel format.
    Any suggestion on how to proceed?

    Thank you, Alberto
Working...
X