Statalist


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

st: using the same macro in program & mata


From   [email protected]
To   [email protected]
Subject   st: using the same macro in program & mata
Date   Mon, 07 Jul 2008 19:12:08 -0700

Hi,

I am writing a program that calls Mata and then, within Mata, calls a Stata command. Currently, what I have written to do this looks something like:

program name
global depvar `1'
mata : temp_("$depvar")
.....
mata:
void temp_(string scalar dep)
{
....
stata("reg $depvar xvar")
....
}
....

The program does what I would like, however, I read in the Stata Manual ([U]18.3.10) that one should never use global macros when a local macro will do the job. Because I will be using this command (name) in conjunction with other programs and sharing it with others, I would like to avoid any possible adverse effects of using the global macro. Is there a way to define this variable (depvar) as a local macro?

Thanks for your consideration,
Maria
*
* 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