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]

st: Using mata in semi-do-file / semi-interactive mode


From   Bert Lloyd <bert.lloyd.89@gmail.com>
To   statalist <statalist@hsphsun2.harvard.edu>
Subject   st: Using mata in semi-do-file / semi-interactive mode
Date   Mon, 19 Mar 2012 11:20:39 -0400

Dear Statalist,

The way I usually build do-files in Stata is to go back and forth
between writing in the do-file and issuing interactive commands -- you
write a bit of code in a do-file, run it to see if it works, fiddle
around in interactive mode to check that your code did what you wanted
it to do and to understand mistakes, go back to correct the do-file,
etc. This may not be the best way to work but it's what I'm used to.

I am finding it difficult to work the same way in Mata, since when the
do-file ends, the contents of Mata appear to be cleared. Similarly, if
there's a mistake in the Mata code, the program seems to stop without
making partial progress, or at least any partial progress that has
been made seems to be cleared. (Please correct me if I'm wrong here.)

The best way I've come up with is to make only tiny incremental
changes to the Mata program, then run repeatedly with lots of "printf"
commands and the like to display what is happening. This is somewhat
slow and cumbersome. Is there a better way? How do others work with
Mata?

Many thanks in advance.

 - BL
*
*   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