Statalist The Stata Listserver


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

Re: st: how to use macro `using' in a program which calls for mata function


From   [email protected] (William Gould, Stata)
To   [email protected]
Subject   Re: st: how to use macro `using' in a program which calls for mata function
Date   Thu, 11 May 2006 08:32:27 -0500

Oleksandr Shepotylo <[email protected]> had a problem using Mata 
from an ado-file.  His problem has been solved.

In his original posting, he called from his ado-file a Mata function he had
written by coding 

            mata spatlag("var", "newvar", `"`using'"')

Oleksandr should change the line to read 

            mata: spatlag("var", "newvar", `"`using'"')

That is, add a colon after the word -mata-.

-mata- without a colon is a great way to use Mata interactively.  
-mata- with a colon is the right way to use Mata in ado-files.
This way, if there is an error in the Mata function, or if the user presses
Break while the Mata function is executing, the ado-file will know of the
problem and will stop executing.  See -help [m3] mata-.

-- Bill
[email protected]
*
*   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