Hi!

I am trying to run the loop below but it returns error r(111) lt3m_qe not found . However, this variable is created (it should be found). Any idea about it?

Thank you so much!

Code:
foreach s in qe nqe {
foreach pi in t3m t6m t1y t2y t3y t5y t7y t10y { 
foreach iv of varlist  mp1  mp2 mp3 mp4 ff1 ff2 ff3 ff4 ed1 ed2 ed3 ed4 { 
forval h  = 0(1)7{
set level 90 
qui: xtivreg2 lr_p_asset (`pi'_e=`iv') l(1/3).lr_p_asset_`s' l(0/3).p_grgdp_`s' l(1/3).`pi' l(0/3).qe  , fe cluster(pairid)
replace F10_`pi'_`iv'_`s'_90= e(widstat)-16.38 if _n == `h'+1 /* Diff with Kleibergen-Paap rk Wald F statistic*/
replace F15_`pi'_`iv'_`s'_90= e(widstat)-8.96 if _n == `h'+1 /* Diff with Kleibergen-Paap rk Wald F statistic*/
qui: lincomest l`pi'_`s'
tab date if e(sample)==1
parmest,label saving(`"asset_`pi'_`iv'_`h'_90_`s'"', replace)
set level 68
qui: xtivreg2 lr_p_asset (`pi'_e=`iv') l(1/3).lr_p_asset_`s' l(0/3).p_grgdp_`s' l(1/3).`pi' l(0/3).qe  , fe cluster(pairid)
replace F10_`pi'_`iv'_`s'_68= e(widstat)-16.38 if _n == `h'+1 /* Diff with Kleibergen-Paap rk Wald F statistic*/
replace F15_`pi'_`iv'_`s'_68= e(widstat)-8.96 if _n == `h'+1 /* Diff with Kleibergen-Paap rk Wald F statistic*/
qui: lincomest l`pi'_`s'
parmest,label saving(`"asset_`pi'_`iv'_`h'_68_`s'"', replace)
}
}
}
}