Announcement

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

  • Append frames ?

    This is probably a "baby" question, but I have searched the Stata documentation and the Statalist and read several tutorials about frames and have not yet found the answer.
    I am generating parallel subsets of the data that I select into a frame, operate on separately for each subset, and then append the files back together as they all have exactly the same variables. I successfully do this by saving each frame as a tempfile and then opening a new frame and appending all the tempfiles into that frame. But it seems like I should be able to append the frames directly in the new combined frame without going through tempfiles. Except I cannot find the syntax for doing that. I have found merge commands but not append commands.

    What is working as an example -- I also can do this in a loop or using frame put, but just spelling out an example to try for clarity about what I mean.

    frame change main
    xcollapse [variables] if subset=1, by(variable) into(frame1 change)
    [some operations on these variables]
    tempfile set1
    save `set1'
    frame change main
    xcollapse [ variables] if subset=2, by(variable) into(frame2 change)
    [some operations on these variables]
    tempfile set2
    save `set2'
    frame change main
    xcollapse [variables] if subset=3, by(variable) into(frame3 change)
    [some operations on these variables]
    tempfile set3
    save `set3'

    frame create combine
    frame change combine
    use `set1'
    append using `set2'
    append using `set3'

    This is not difficult and it works but it seems inelegant. Is there a way to do this directly with frame commands without going through creating the tempfiles? I found the merge commands for frames, but not append.



  • #2
    There are three user-written packages that seem relevant: frameappend, xframeappend and fframeappend. I'm not familiar enough with them to say which would be better-suited to your case.

    https://ideas.repec.org/c/boc/bocode/s458685.html

    https://github.com/JuergenWiemers/fframeappend

    https://ideas.repec.org/c/boc/bocode/s458923.html
    Last edited by Bert Lloyd; 16 Jan 2026, 07:34.

    Comment


    • #3
      Thank you!!

      Comment

      Working...
      X