代码拉取完成,页面将自动刷新
capture program drop nwload
program nwload
syntax [anything(name=loadname)][, id(string) nocurrent xvars labelonly force]
nwset, nooutput
if ("`id'" == ""){
_nwsyntax `loadname', max(1)
local loadname = "`netname'"
nwname `loadname'
}
else {
nwname, id("`id'")
}
local nodes = r(nodes)
if (`nodes' > 1000 & "`force'"=="") {
local labelonly "labelonly"
}
if (`=`c(k)' + `nodes'' >= `c(max_k_theory)' & "`force'"=="") {
local labelonly "labelonly"
}
if (`nodes' > 1000 & "`force'" == "" & "`labelonly'" == "") {
exit
}
if (`=`c(k)' + `nodes'' >= `c(max_k_theory)' & "`force'" == "" & "`labelonly'" == "") {
exit
}
scalar onename = "\$nwname_`id'"
local localname `=onename'
scalar onevars = "\$nw_`id'"
local localvars `=onevars'
scalar onelabs = "\$nwlabs_`id'"
local locallabs `"`=onelabs'"'
if "`labelonly'" != "" {
capture drop _nodelab
capture drop _nodeid
capture drop _nodevar
if `=_N' < `nodes' {
set obs `nodes'
}
gen _nodelab = ""
gen _nodevar = ""
gen _nodeid = _n if _n <= `nodes'
local j = 1
foreach lab in `locallabs' {
qui replace _nodelab = `"`lab'"' in `j'
local j = `j' + 1
}
local j = 1
foreach var in `localvars' {
qui replace _nodevar= `"`var'"' in `j'
local j = `j' + 1
}
exit
}
qui if (("`xvars'" == "") & ("`labelonly'" == "")){
capture drop _nodelab
capture drop _nodevar
qui mata: st_addvar("str20", "_nodelab")
qui mata: st_addvar("str20", "_nodevar")
if _N < `nodes' {
set obs `nodes'
}
local i = 1
foreach var in `localvars' {
capture drop `var'
if `i' <= `nodes' {
qui replace _nodevar = "`var'" in `i'
}
local i = `i' + 1
}
local j = 1
foreach lab in `locallabs' {
if `j' <= `nodes' {
qui replace _nodelab = `"`lab'"' in `j'
}
local j = `j' + 1
}
capture drop _nodeid
gen _nodeid = _n if _n <= `nodes'
nwtostata, mat(nw_mata`id') gen(`localvars')
}
if ("`current'" != "nocurrent") {
nwcurrent, id(`id')
}
end
*! v1.5.0 __ 17 Sep 2015 __ 13:09:53
*! v1.5.1 __ 17 Sep 2015 __ 14:54:23
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。