Passing arguments to Mata functions
In designing a subroutine, you have two paramount interests: how you get data into your subroutine and
how you get results back. You get data in by the values you pass as the arguments. For calcsum(),
we called the subroutine by coding
mata: calcsum("`varlist'", "`touse'")
After macro expansion, that line turned into something like
mata: calcsum("mpg", " 0001dc")
The 0001dc variable is a temporary variable created by the marksample command earlier in our
ado-file. mpg was the variable specified by the user. After expansion, the arguments were nothing
more than strings, and those strings were passed to calcsum().
|