Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: a question about local macro


From   adiallo5@worldbank.org
To   statalist@hsphsun2.harvard.edu
Subject   st: a question about local macro
Date   Fri, 11 Nov 2005 11:52:03 -0500

Jian,


You need global.


Remember, if you run a dofile with a local,


and then rerun only a portion of your dofile,


stata will "forget" the local (it assumes its


a new dofile session).


HTHs.


Amadou.





Jian Zhang wrote:





Hello,

I have a question about the local macro.  I could not figure out why
and
how to get around it.  Hope that you can help me out.

Here is the question.  In my do file, I have two commands as follows:

local IC="IC412 IC413"
reg y `IC'

The question is that when I run the two commands together
it works.  But I found that if I then re-run the second command without
running the first command,  I thought it should give the same results
since i have already defined the local macro, so I do not need to
redefine it.  It turns out that this time stata treated `IC' as empty.
That means if I want to run the second command,  i always need to run
the
two commands together.  Am I correct?  Any explanations? Is there
anyway
to get around this?
Thanks!

Best,

Jian Zhang
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index