Home  /  Products  /  Stata 19  /  Modify a set of frames on disk

← See Stata 19's new features

Highlights

  • Modify frameset files without loading them into memory

  • Conveniently add or drop frames from frameset files

  • See more data manipulation features

If you work with multiple datasets in memory or frames, you can now modify a frameset (.dtas) file without loading it into memory—add frames in memory to the frameset file, or drop frames from the frameset file.

Data frames were introduced in Stata 16 to allow working with multiple datasets in memory. In Stata 18, we added the capabilities to save and load a set of frames, known as a frameset.

We now introduce frames modify, which allows you to conveniently modify a frameset file without loading it into memory. You can add frames in memory to a frameset with frames modify, add(). You can drop a set of frames from a frameset with frames modify, drop().

Let's see it work

Suppose we are working with two longitudinal datasets to explore economic behavior over time. One of the datasets has information about labor outcomes of individuals over time (nlswork.dta), and the other has information about market values of companies over time (grunfeld.dta).

. frame create workers
. frame change workers
. webuse nlswork
(National Longitudinal Survey of Young Women, 14-24 years old in 1968)

. frame create companies
. frame change companies
. webuse grunfeld

We now save all frames in a frameset:

. frames save myframeset, frames(workers companies)
file myframeset.dtas saved

Now suppose we want to look into patterns of domestic research and development. We have a longitudinal dataset xtcoint.dta.

. frame create RandD
. frame change RandD
. webuse xtcoint
(Fictitious cointegration data)

We can add frames to the potentially large frameset without loading the latter into memory:

. frames modify using myframeset, add(RandD)
frame RandD added
file myframeset.dtas saved

We now have a frameset with three features of the economy over time:

. frames describe using myframeset, short

Frame: workers Contains data National Longitudinal Survey of Young Women, 14-24 years old in 1968 Observations: 28,534 13 Mar 2025 11:22 Variables: 21 Sorted by: idcode year
Frame: companies Contains data Observations: 200 13 Mar 2025 11:22 Variables: 6 Sorted by: company year
Frame: RandD Contains data Fictitious cointegration data Observations: 15,000 13 Mar 2025 11:22 Variables: 5 Sorted by: id time

We can drop frames from the frameset without loading it:

. frames modify using myframeset, drop(workers)
frame workers dropped
file myframeset.dtas saved

We now have

. frames describe using myframeset, short

Frame: companies Contains data Observations: 200 13 Mar 2025 11:22 Variables: 6 Sorted by: company year
Frame: RandD Contains data Fictitious cointegration data Observations: 15,000 13 Mar 2025 11:22 Variables: 5 Sorted by: id time

Tell me more

Read more about the new frames modify command in [D] frames modify in the Stata Data Management Reference Manual.

For an introduction to the many functions of frames, see [D] frames intro, and see [D] frames for a quick reference to the individual frames commands and functions.

Learn more about Stata's data management features.

View all the new features in Stata 19, and, in particular, new in data management.

Ready to get started?

Experience powerful statistical tools, reproducible workflows, and a seamless user experience—all in one trusted platform.