Announcement

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

  • merging datasets

    Hi,
    I need help to merge information into an existing dataset, which has a wide format. In the rows I have got each region with the same identifier
    Exemple of the dataset
    Demo Reg year
    139775 AT11 1990
    752424 AT12 1990
    808630 AT13 1990
    281917 AT21 1990
    607186 AT22 1990
    670153 AT31 1990
    246020 AT32 1990
    318816 AT33 1990
    164982 AT34 1990
    I would like to merge information from different tables in Excel format such as:
    Reg 1990 1991 1992
    AT11 22.5 18.4 17.3
    AT12 19.2 17.8 17.2
    AT13 16.6 8.6 9.3
    AT21 36.5 23.5 23.9
    AT33 13.1 12.4
    AT34 21.4 19.4
    I understand that I need to merge by identifier and year, but I would need to copy the year for each datapoint and copy paste the year to have the data into a single column. Is there any option in stata to do it automatically?
    Thanks for your help.

  • #2
    You could merge it piece-wise by saving different .dta files for each year (with a new variable "year" equal to the year (i.e. 1990) for your using data).

    Comment


    • #3
      Yes Stata can do that for you. You are looking for reshappe. First reshape the excel data and then merge it using the merge command.
      Code:
      help reshape
      help merge
      provide various examples.

      Comment

      Working...
      X