I have a simple do-file that contains a program, which itself contains some Mata syntax:
When I run this, I get an r(3499) error of "<istmt>: 3499 v not found" on this line:
Based on my reading of the documentation for -st_view()- (http://www.stata.com/manuals13/m-5st_view.pdf) this syntax should be correct, since I shouldn't have to declare the matrix -v- beforehand. Am I reading that right? What's the problem here?
And yes, I know this is a silly example of a do file that could easily be rewritten without Mata, e.g. like this:
but this started out as a minimal working example I was using to figure out another error message, and it's a simple example of a larger program I'm working on.
Thank you,
Michael Anbar
Code:
capture program drop take_log program take_log syntax varname [if] [in], Generate(name) marksample touse quietly gen `generate' = . mata: st_view(v, ., "`varlist'", "`touse'") st_view(logv, ., "`generate'", "`touse'") logv[., .] = ln(v) mata end end cls set more off sysuse gnp96, clear take_log gnp96, g(log_gnp96)
Code:
st_view(v, ., "`varlist'", "`touse'")
And yes, I know this is a silly example of a do file that could easily be rewritten without Mata, e.g. like this:
Code:
capture program drop take_log program take_log syntax varname [if] [in], Generate(name) marksample touse gen `generate' = ln(`varlist') if `touse' end cls set more off sysuse gnp96, clear take_log gnp96, g(log_gnp96)
Thank you,
Michael Anbar
Comment