nwerrorcodes

Return codes of nwcommands

Description

Most errors raised by nw* commands are Stata’s own standard return codes, used for their usual meaning (e.g. 198 invalid syntax, 99 a Stata variable already exists). A number of recurring, network-specific situations do not have a natural existing Stata code, so this package defines its own small set of custom codes instead of inventing a new number per command. This page documents every one of them - if you catch one of these programmatically (e.g. capture ... / if _rc == 482), this is the authoritative list of what it means and which commands can raise it.

These codes are also available as named local macros from unw_defs.ado (used internally by this package’s own commands) - e.g. ````errNWsNotFound``’` instead of the bare number 482.

Examples

Catch a package-specific error code programmatically:

. nwclear
. capture nwname doesnotexist
. display _rc
. if _rc == 482 {
.     display "network not found"
. }

See also


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.