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: Temporary variables saved by accident
From
Adrian Sayers <[email protected]>
To
[email protected]
Subject
st: Temporary variables saved by accident
Date
Wed, 09 Jan 2013 13:18:09 +0000
Hi All,
I have come across some strange behaviour. After saving a file which uses
temporary variables, the temporary variables are also saved, and converted
to permanent variables. I had assumed this would not happen?
If i run all the code together i have no problems.
But if i run part 1 , then part 2 i get an error message of "__000002
already defined"
I am running version 21.1
// Part 1
clear
set obs 100
gen age_1 = 10
tempvar P n
gen `P' = uniform()
sort `P'
gen `n' = _n
save error_test.dta , replace
// Part 2
use error_test.dta , clear
de
hist age
so the work around is
drop __00*
But why does this happen?
Many thanks
Adrian
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/