Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Learning Mata: what is the best way?


From   Kyle Hood <[email protected]>
To   [email protected]
Subject   Re: st: Learning Mata: what is the best way?
Date   Wed, 23 Jan 2008 16:49:20 -0500 (EST)

i==1 in the for statement should be i=1, to debug your program. Otherwise, I do not know what to suggest for learning the language except to use examples of others' work.

Kyle

On Wed, 23 Jan 2008, [email protected] wrote:


Hi:

I have been programming for a couple of years in Stata (now using Stata/SE 9.2)
and I am currently deciding whether to learn Mata (or switch to something like
Matlab), so I have a couple of questions:

  What is the best way to learn Mata? I bought the books M[0-3] and M[4-6], but
  they are reference guides, not learning books. Is there not a book/website,
  etc. that shows more snippets of code so you can actually learn the language
  by example?
  I played around a bit, but I even failed to create something as elementary
  as:

function tryit()
{
for (i==1; i<10; i++) printf("i=%g\n",i)
}

After writing this in the do editor and running it, I get the following error:

nothing found where 'while' expected

Alternatively, when I input it interactively and then call it with:

tryit()

I get this error message:

tryit():  3200  conformability error
<istmt>:     -  function returned error

Not exactly your average "Hello World!" gratification, so your help would be
much appreciated!


Cheers,
Erik

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index