Bookmark and Share

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

[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 <[email protected]>
To   statalist <[email protected]>
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

Many thanks in advance.

 - BL
*   For searches and help try:

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