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

st: Re: Problem with tempvar __000000


From   "Steichen" <[email protected]>
To   <[email protected]>
Subject   st: Re: Problem with tempvar __000000
Date   Mon, 21 Jun 2004 02:00:23 -0400

Renzo --

For the situation you describe below, retention of the temp variable in the
saved dataset is the expected behavior.

Temp variables are deleted automatically only when their creating program
(or do file) ends. Thus they remain in existence until dropped or the
program (or do file) that created them ends.  It follows that if you create
a temp variable in the "main" program level of Stata, the temp variable
remains in existence until either dropped or you exit from Stata. If you do
a -save- without specifying which variables, all variables, including temp
variables, get saved.

I tried your example, exactly as you show below but on Stata SE (not
Intercooled), born the same date you show, and I do not get any error
message even though __000000 exists.  Thus the entanglement of Graph with
the temp variable may be an Intercooled problem.

Tom



----- Original Message ----- 
From: "Renzo Comolli" <[email protected]>
To: <[email protected]>
Sent: Monday, June 21, 2004 12:41 AM
Subject: st: Problem with tempvar __000000


> A variable created by -tempvar- is hanging around inside the saved
dataset.
> Its name is __000000
> Is that normal behavior? I had never noticed this behavior before, but
maybe
> I am just confused.
>
> See the (reproducible) code below, taken from my results window.
> The case presented here is benign, but soemtimes malign cases occur:
> A. the code gives an error message and still performs the operation, as in
> the exaple of -twoway- here below
> B. I believe that at least in one case, it actually broke the code. It was
> in a -reshape long-. (I can't be sure though, because I was tearing a huge
> file apart to figure out where the problem was coming from).
>
> If, after the code below, you actually issue once again
> . use debugauto, clear
> then variable __000000 appears in the variable window.
>
> Any clarification? Is it a bug? I am missing something?
>
> Best Regards,
> Renzo Comolli
>
>
>
> Here is the code to reproduce (most) of the behavior described.
>
> . about
> Intercooled Stata 8.2 for Windows
> Born 18 May 2004
>
> . sysuse auto, clear
> (1978 Automobile Data)
>
> . tempvar num_miss
>
> . gen `num_miss'=0
>
> . save debugauto, replace
> file debugauto.dta saved
>
> .
> . use debugauto, clear
> (1978 Automobile Data)
>
> . describe __000000
>
>               storage  display     value
> variable name   type   format      label      variable label
> --------------------------------------------------------------------------
--
> ---
> __000000        float  %9.0g
>
> . tab __000000, mi
>
>    __000000 |      Freq.     Percent        Cum.
> ------------+-----------------------------------
>           0 |         74      100.00      100.00
> ------------+-----------------------------------
>       Total |         74      100.00
>
> . twoway (lfit  price  mpg) (scatter  price mpg), by( foreign)
> __000000 already defined
>
> * but the graph still appears correctly
>
>
> *
> *   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/

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index