nwrestore

Restore network data previously preserved

Syntax

nwrestore

Description

nwrestore restores network data (including all normal Stata variables) previously saved by nwpreserve - the network-aware counterpart of Stata’s own preserve/ restore pair. If nothing was preserved (or it was already restored once), nwrestore reports “Nothing to restore” and does nothing further.

The temporary file nwrestore reads from is deleted once restored, so a given nwpreserve call can only be restored once - exactly like Stata’s own preserve/restore.

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 - restores the full working state saved by nwpreserve, 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.