Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[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 <klein.daniel.81@googlemail.com>
To   statalist@hsphsun2.harvard.edu
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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index