nwvalidvars

Validate Stata variables for network

Syntax

nwvalidvars 
nodes ,
stub(string)

Description

Validates names of Stata variables that can be used to represent a network of size nodes. Stata variables are generated by combining stub() with a consecutive number. If these Stata variables already exists, the command comes up with a new suggestion for naming variables. This command is mostly used for progamming.

Examples

. nwclear
. nwwebuse gang
. nwvalidvars 10, stub(g)
. return list

Supported network types

Not applicable - a pure Stata-variable-name bookkeeping utility (finds a collision-free stubN variable-name pattern for a given node count); does not read or depend on any network’s own content, directed/valued/two-mode status, or tie values at all.

Stored results

  • r(stub) stub used to generate Stata variable names
  • r(valid) “true” when Stata variables do not already exist, “false” otherwise
  • r(validvars) list of valid Stata variables

Back to top

nwcommands is free to install and use, including for commercial research. See the GitHub repository for source, license, and issue tracking.

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