Hi Community,
I'm writing a nested Loop with Stata,
the Variable Cur is a numeric with label, and I want to do rdplot for each Cur,
with running variable in each of h_pes h_med and h_opt, with any cutoff of 0.1-0.9
Here's the code:
forval frx = 1/6{
preserve
keep if Cur == `frx'
local curname: label Cur `frx' // 取回Cur = `frx' 对应的label
foreach v in h_pes h_med h_opt {
forval i = 1/9{
local cut = `i'/10
local title = "Cur_`curname'_Cutoff_`i'_`v'"
rdplot exchange `v', c(`cut') ti("`title'") ///
name(fig`frx', replace)
}
}
restore
}
But I get ERROR:
<istmt>: 3301 subscript invalid
r(3301);
Does Anyone has an idea about what's happening?
I'm writing a nested Loop with Stata,
the Variable Cur is a numeric with label, and I want to do rdplot for each Cur,
with running variable in each of h_pes h_med and h_opt, with any cutoff of 0.1-0.9
Here's the code:
forval frx = 1/6{
preserve
keep if Cur == `frx'
local curname: label Cur `frx' // 取回Cur = `frx' 对应的label
foreach v in h_pes h_med h_opt {
forval i = 1/9{
local cut = `i'/10
local title = "Cur_`curname'_Cutoff_`i'_`v'"
rdplot exchange `v', c(`cut') ti("`title'") ///
name(fig`frx', replace)
}
}
restore
}
But I get ERROR:
<istmt>: 3301 subscript invalid
r(3301);
Does Anyone has an idea about what's happening?
Comment