nwpreserve

Preserve and restore network data

Syntax

Preserve network data
nwpreserve
    Restore network data
nwrestore

Description

nwpreserve preserves network data by temporarily saving the current network dataset (including all normal Stata variables) in the working directory.

nwrestore restores network data previously preserved (including all Stata variables).

Examples

Preserve a network, drop it, then restore it:

. nwclear
. nwrandom 5, prob(.4) name(mynet)
. nwpreserve
. nwdrop mynet
. nwset
. nwrestore
. nwset

Supported network types

Binary: yes. Directed: yes. Weighted: yes. Signed: yes. Two-mode: yes - saves/restores the full working state (every loaded network and its own directed/valued/two-mode status, plus the Stata dataset), independent of any of these properties.


nwcommands version 3.17.6, 9 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.