| ![](/includes/contimages/spacer.gif) |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: RE: Local macro & Temp variable with same name?
Well,
When you issue a command like
tempvar mytemp
What Stata is doing is picking out a variable name for you (something like
__000001), and assigning that name to the local macro called mytemp.
So then, whenever you refer to the local macro, as `mytemp', stata is
seeing the name __000001 , which refers to your temporary variable.
So if you reassign the local macro -mytemp- to be something else, you will
lose access to your tempvar.
But you could have a local macro called __000001 , which you could refer to
as `__000001'. That would have no relation to the variable named
__000001. (Just as a local macro `mpg' has no relationship to the variable
mpg.)
But why?
--NIck Winter
At 01:18 PM 3/17/2006, you wrote:
Have no intention. It just _sounds_ like a bad idea. But I was curious!
Danielle
--
National Bureau of Economic Research <http://www.nber.org>
---------- Original Message -----------
From: "Nick Cox" <[email protected]>
To: <[email protected]>
Sent: Fri, 17 Mar 2006 18:10:48 -0000
Subject: st: RE: Local macro & Temp variable with same name?
> Principle 1: Whatever you say last is true.
>
> Principle 0: In essence, don't do this!
>
> Nick
> [email protected]
>
> Danielle H. Ferry
>
> > Will Stata know the difference between a local macro and a
> > temporary variable with the same name?
*
* 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/
--------------------------------------------------------
Nicholas Winter 607.255.8819 t
Assistant Professor 607.255.4530 f
Department of Government [email protected] e
308 White Hall falcon.arts.cornell.edu/nw53 w
Cornell University
Ithaca, NY 14853-4601
*
* 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/