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

st: RE: RE: renaming contents of local macros

From   "Nick Cox" <>
To   <>
Subject   st: RE: RE: renaming contents of local macros
Date   Fri, 10 Sep 2004 11:06:28 +0100

To expand on this a little, without giving 
the whole story: 

1. A macro is a named string. So in 

local unlucky "13" 

the macro has name -unlucky-, and contents 

2. When you go 

local fitted "`endog'" 

all you are doing is saying "the local with name 
-fitted- should now have the contents of the macro 
with the name -endog-". If -fitted- didn't exist before, 
it is created; if it did, its contents are overwritten. 

3. In your case -fitted- previously contained the

__000003 __000005 __000007

which from context are names of temporary variables. 
Note that nothing you are doing above -rename-s those
temporary variables. They keep whatever names they had 

Also, note that if you ran this program again the 
names might look different. This is a matter of Stata's 
internal housekeeping. If I go

tempvar lucky 

Stata reserves some name -- it might be __000008 -- and
it established a little rule for itself: if I refer to 
`lucky', this means __000008 (unless and until I overwrite
the contents of -lucky-). 


Nick Cox
> . local fitted "`endog'" 
> Patricia Sourdin
> > I have a question on renaming a tempvar in anyone could help please.
> > I would like to replace the contents of the macro tempvar 
> > 'fitted' with the 
> > contents of another macro 'endog'
> > eg replace the just the names in 'fitted' with the names in 'endog'
> > 
> > 
> > di "`fitted'"
> >  __000003 __000005 __000007
> > 
> > di "`endog'"
> > HHinc_no_invest invest_inc hyperindex

*   For searches and help try:

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