Announcement

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

  • Merge with frames

    Dear All,

    just a very quick question. I have a panel data under a frame named wdi and another one under the name kof. I would like to merge the two datasets. Is it possible to link the two datasets using something like merge m:m.

    I tried the following:

    Code:
    frlink m:m country year, frame(kof)
    However it does not work. Is there any solution to this? Possibly I am misinterpreting the meaning of frames.

    Thanks in advanced,

    Dario

  • #2
    Dear All,

    please discard the previous message. I understood that frger should follow frlink.

    Comment


    • #3
      Hi Dario, glad you solved the problem. There is another subtle difference with linking frames, in that it is not like -merge- in the sense that it will not automatically generate unmatched levels of the linking variable from the "using" frame.

      Code:
      clear *
      cls
      
      frame create A
      frame change A
      input byte id
      1
      2
      3
      end
      
      frame create B
      frame change B
      input byte id
      2
      3
      4
      end
      
      frame change A
      frlink 1:1 id , frame(B) gen(lb)
      list
      result

      Code:
           +---------+
           | id   lb |
           |---------|
        1. |  1    . |
        2. |  2    1 |
        3. |  3    2 |
           +---------+

      Comment


      • #4
        Leonardo Guizzetti thanks for pointing this out. Indeed, i realized that you do not have a variable which indicates the unmatched data. Maybe this is something to suggest for Stata 18. Nonetheless, while I was not a supporter of frames, i realized that they could be useful, to "open" more datasets at the same time without moving back and forth different Stata pages. So i will try to deeper my knowledge of the command.

        Comment

        Working...
        X