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

st: using the same macro in program & mata

Subject   st: using the same macro in program & mata
Date   Mon, 07 Jul 2008 19:12:08 -0700


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")
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,
* For searches and help try:

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