nwuse

Load a Stata network dataset

Syntax

nwuse
filename
[,
nwclear
nwappend
force]
nwwebuse
netexample
[,
nwclear]
   
nwclear clear memory before loading dataset
nwappend append to existing data
force when combined with nwappend, if the incoming data contains a network with the same name as one already in memory, auto-renumber the incoming network to a fresh name instead of erroring - unlike replace elsewhere in this group (e.g. nwset), which overwrites the existing network in place under the same name, force leaves the existing network untouched

Description

nwuse loads a Stata network dataset previously saved with nwsave. This includes all networks and Stata variables. If filename is specified without an extension, .nwdta is assumed. If your filename contains embedded spaces, remember to enclose it in double quotes.

Every network comes back as it was saved: a network saved as directed stays directed even when its ties happen to be symmetric, and a two-mode network keeps the node order it was saved in.

Network types

The command works the same for every network type (see nwnetworktypes); files of two-mode networks that list every pair of nodes also load. A temporal network (event, snapshot or interval network, see nwset) comes back with its times, and with its type and the names of its time variables, exactly as nwsave wrote them; a file written without times (by an earlier version, or of a network that is not temporal) loads as a network that is not temporal.

Limits

For all commands at network sizes of 1,000 to 100,000 nodes see the web page How large a network can I analyze?

Examples

This example creates 5 new random networks and saves them as mynets.A new dataset called mynets.nwdta is created in the working directory with the networks and all Stata variables.

. nwclear
. nwrandom 20, ntimes(5) prob(.2)
. nwsave mynets
. nwclear

One can bring the data back with:

. nwuse mynets

This load the Florentine dataset from the internet and appends it to the existing data.

. nwwebuse florentine, nwappend

See also


nwcommands version 3.25.0, 14 November 2026 (check your installed version)


Back to top

nwcommands is free software under the GNU General Public License, version 3, as are the model packages nwsaom, nwergm, nwdynam and nwrem. Citing and licenses · Get help · GitHub. Issues with the core go to the nwcommands repository; issues with a model package go to that package's own repository.

This site uses Just the Docs, a documentation theme for Jekyll.