Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: On calling a mata-defined function in Stata


From   daniel klein <[email protected]>
To   [email protected]
Subject   Re: st: On calling a mata-defined function in Stata
Date   Wed, 11 May 2011 17:58:06 +0200

Did you even take a short look at the hepl files or the manual? I do
not thin so.
Also do not just pick up on sentences that are said in a specific context.

I am also very new to Mata, but here's a shot:

---example---
mata :
void somename(string scalar x, string scalar name)
{
myname = name
y = st_numscalar(x)
y = y^2 + 2*y
st_numscalar(myname, y)
}

sca x = 5
mata : somename("x", "y")
di x
di y

As you can see for yourself, this hardly seems  "more elegant" than
simply coding

sca x = 5
sca y = x^2 + 2*x

I feel that Mata is very powerfull, but there are certainly a lot of
situations where it is not needed at all.

Best
Daniel
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index