Inside a larger loop I run reghdfe after which I do some evaluations in Mata. I learned this can be only a one-liner (otherwise the loop breaks at Mata's "end") so I need to define a Mata function called by the one-liner. So far so good. My problem is that once reghdfe has run, the previously defined Mata function is forgot. Here is a MWE:
Code:
cls
clear all
adopath + // path to reghdfe.ado goes here
mata
    real matrix mtest()     { 
        return(runiform(3,4))
    }
end
mata: st_matrix("rt1",mtest()) // works
mat li rt1
sysuse auto
qui reghdfe price foreign mpg, absorb(i.rep78) // reghdfe makes mata forget the function mtest()
mata: st_matrix("rt2",mtest()) // error <istmt>:  3499  mtest() not found
mat li rt2Peter
0 Response to reghdfe makes Mata forget Mata functions
Post a Comment