Announcement

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

  • How to merger data vertically?

    Hi all experts,

    I have problems regarding merging three datasets vertically, all data set contain only four variables
    An example

    Dataset 1:

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input str6 TYPE byte year long(Sheet2 Sheet3 Sheet4)
    "13265V" 2 1591233 3098527 475739
    "13265V" 3 1814453 3230866 482599
    "13265V" 4 1997213 3487706 455801
    "13265V" 5 1782173 3364828 468144
    "13265V" 6 2031912 3318902 467437
    "13265V" 7 2426967 3800973 519610
    "135392" 2       .       .      .
    "135392" 3       .       .      .
    "135392" 4       .       .      .
    "135392" 5       .       .      .
    "135392" 6       .       .      .
    "135392" 7       .       .      .
    end

    Dataset 2

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input str6 TYPE byte year long(Sheet2 Sheet3 Sheet4)
    "135393" 2 . . .
    "135393" 3 . . .
    "135393" 4 . . .
    "135393" 5 . . .
    "135393" 6 . . .
    "135393" 7 . . .
    end
    Dataset 3

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input str6 TYPE byte year long(Sheet2 Sheet3 Sheet4)
    "135394" 2 . . .
    "135394" 3 . . .
    "135394" 4 . . .
    "135394" 5 . . .
    "135394" 6 . . .
    "135394" 7 . . .
    end
    And I want the result is as below

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input str6 TYPE byte year long(Sheet2 Sheet3 Sheet4)
    "13265V" 2 1591233 3098527 475739
    "13265V" 3 1814453 3230866 482599
    "13265V" 4 1997213 3487706 455801
    "13265V" 5 1782173 3364828 468144
    "13265V" 6 2031912 3318902 467437
    "13265V" 7 2426967 3800973 519610
    "135392" 2       .       .      .
    "135392" 3       .       .      .
    "135392" 4       .       .      .
    "135392" 5       .       .      .
    "135392" 6       .       .      .
    "135392" 7       .       .      .
    "135393" 2       .       .      .
    "135393" 3       .       .      .
    "135393" 4       .       .      .
    "135393" 5       .       .      .
    "135393" 6       .       .      .
    "135393" 7       .       .      .
    "135394" 2       .       .      .
    "135394" 3       .       .      .
    "135394" 4       .       .      .
    "135394" 5       .       .      .
    "135394" 6       .       .      .
    "135394" 7       .       .      .
    end
    Could you please guide me how to sort it out? Best regards


  • #2
    This is what -append- is for, not -merge-.

    Code:
    clear
    append using dataset1 datset2 dataset3
    Read -help append- for more information about this important command.

    Comment


    • #3
      Originally posted by Clyde Schechter View Post
      This is what -append- is for, not -merge-.

      Code:
      clear
      append using dataset1 datset2 dataset3
      Read -help append- for more information about this important command.
      Thanks a healp, I got it

      Comment

      Working...
      X