[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: RE: RE: renaming contents of local macros
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
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-).
> . 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: