Stata Frames
Frames are in-memory datasets that can be swapped in and out of being the active dataset.
Contents
Definition
The active dataset is automatically also the default frame. It can be renamed like:
frame rename default oldframe
A new frame is created like:
frame create newframe
The frame dir command lists all frames, their size (as number of rows x number of columns), and the dataset label (if any).
Usage
frame copy oldframe frame1 frame put foo bar baz, into(frame2) frame put if foo==1, into(frame3)
frame1 contains a complete copy of oldframe. frame2 contains all rows and 3 columns of oldframe. frame3 contains all columns and a subset of rows of oldframe.
frame change newframe
The alias cwf can be used in the same way.
frame drop frame1 frame2 frame3
Note that the active frame cannot be dropped. To truly reset the status of frames, try frame reset.
Frame Scope
A frame scope can be entered with frame FRAMENAME: This environment executes within the specified frame and returns to the current frame at the end of the statement.