Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: RE: local macro
"Nick Cox" <email@example.com>
st: RE: local macro
Tue, 27 Apr 2010 16:24:00 +0100
This isn't very clear to me, as you give lots of details but not all the
But the mention of a do file suggests that you are defining a local
macro and one place and trying to use it in another.
-local- means precisely that.
Local macros are local to one of
1. an interactive session
2. a -program- defined as such
3. a do file
4. a do file editor window, whether saved as a file or not
and are not visible outside any such context.
It may well be that globals will serve your purpose better.
I was wondering if you could help me clarify something about local
macros. I use Stata 11. I have a log do file with probably 100
regressions. I am essentially testing 2 models the 2nd one being an
extension of the first in a sense that I use all the variables that
proved important in the first model and add some new ones. To make
editing easier once I finalised the first model I created a local macro
which is a list of variables used in the first model and used it when
running out the regressions of the second model. It works fine if I run
my whole do file continuously. However, when I want to run just a few
e.g. the line with a local macro and some regressions a few paragraphs
down which use the macro in question
Stata does not seem to recognise my local macro.
Here is a sample of my commands:
local streglist prsexratio2039 citotalgen osaka age agesq height weight
income smoker withfam university goodhealth face3 sightprobl
streg `streglist' nodes desartokyo desosaka mindesinc if age<=40,
I just wanted to confirm is it possible to use a local macro the way I
was trying to and in that case what am I doing wrong? Or is it
impossible and I should set a global macro instead?
* For searches and help try: