Actually, it works exactly like in R, because nwergm uses R in the background. Essentially, it saves the network data as a normal Stata dataset, loads the Stata dataset in R (and makes a network object out of it) and runs the necessary ERGM code before feeding the result back to Stata. Hence, when R opens a Stata dataset with missing values, these missing values show up in the network and your ERGM analysis.
Within Stata, there is no special treatment of missing values other than the one provided by Stata. For example, you can declare the edge value between node 2 and node 3 of a random network as missing like this:
. nwrandom 10, prob(.2) name(mynetwork) // this generates the random network mynetwork
. nwreplace mynetwork[2,3] = .
Concerning the combination of attribute data with networks, just do what Peter suggested. First, build a complete attribute file with "merge". This is normal Stata code and should not be too difficult. Below is the syntax that does something like this when your attribute files are simple text files with one column.
local attributes "age sex"
local maxN = 0
// Transform your .txt in .dta files and add a _id
foreach a in `attributes' {
import delimited "`a'.txt", clear
rename v1 `a'
gen _id = _n
save `a'.dta, replace
if `maxN' < `=_N' {
local maxN = _N
}
}
// Merge all attribute files together
clear
set obs `maxN'
gen _id = _n
foreach a in `attributes' {
merge 1:1 _id using `a'.dta, nogenerate
}
// Import or use your network
nwuse...
nwimport...
Best,
Thomas