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.
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.

Comment