I have two ados: Ado1 for an estimation command calling Ado2 in ml model, and Ado2 for the estimation algorithm. How can I transfer a temporary variable created in Ado1 to Ado2? Below is a simplified example:
Code:
program Ado1
syntax varlist [if] [in]
gettoken y rhs : varlist
tempvar TV
gen `TV'=_n
ml model lf Ado2 (`y' = `rhs') () `if' `in', `vce'
ml max
end

program Ado2
args lnf mu lnsigma
summ `TV'
quietly replace `lnf' = ln(normalden($ML_y1, `mu', exp(`lnsigma')))
end