It's not clear to me why the following program, *saved as an ado file* won't throw an error despite the -mata set matastrict on- (within the ado itself) and the lack of declarations.
The program (edited by me: I added the "mata set matastrict on") comes from https://www.stata.com/manuals13/m-1ado.pdf , section "Advice: Use of matastrict".
Am I missing something?
Code:
program varsum
version 13
syntax varname [if] [in]
marksample touse
mata: calcsum("`varlist'", "`touse'")
display as txt " sum = " as res r(sum)
end
version 13
mata:
mata set matastrict on
void calcsum(varname, touse)
{
st_view(x, ., varname, touse)
st_numscalar("r(sum)", colsum(x))
}
end
Am I missing something?
Code:
. program dir
ado 387 varsum
mata 248 varsum.calcsum()
--------
635

Comment