| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: a question about tempvar
Dear Jian,
__000000 corresponds to the name of the temporary variable `tempxxx'. This "temporary" variable is not dropped in the saved file (only at the end of your command). The solution is to add
drop `tempxxx'
before the line
save file1.dta, replace
Jean-Benoit
Jian Zhang a �crit :
Dear Stata Users,
Have you run into the following problem when using command tempvar? I can
not fix the problem. Hope that you can help me out.
The problem is as follows. Sometimes I need to use some temporary
variables. So I use command tempvar.
For example, my do file is the following:
use file.dta, clear
sort eid
tempvar temxxx
by eid: gen `temxxx'=_n
drop if `temxxx'!=1
sort eid
save file1.dta, replace
The problem is that after I run the whole do file, which will save the
data in file1.dta, next time I open file1.dta, I ALWAYS find that there is
an additional variable, which is __000000, is added to my data. All of
the values of this variable is 1. So I have to delete this variable and
resave the whole data. I have run into this problem several times and
could not find why and how to fix it. If this is going to be the way, it
seems to me that it is much more convinent that I could just creat a new
variable called temxxx and then drop it later on when I don't need it anymore.
Is there a way that I can get around this? Thanks.
Jian Zhang
*
* 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/
--
***************************************************************************
Jean-Benoit Hardouin
Biostatisticien
Observatoire R�gional de la Sant� du Centre
BP 2439
1, rue Porte Madeleine
45032 Orl�ans Cedex 1
t�l : 02 38 74 48 80
fax : 02 38 74 48 81
Email : [email protected]
**************************************************************************
*
* 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/