Others have pointed to -set varabbrev off-. Note that this is documented
at
SJ-5-3 dm0016 . . . . . . . . . . . Stata tip 22: Variable name
abbreviation
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
P. Ryan
Q3/05 SJ 5(3):465--466 (no
commands)
tip for using set varabbrev to determine whether or
not to allow variable abbreviations
and thus in
Book . . . . . . . . . . . . . . . . . . . . . . . Thirty-three
Stata Tips
. . . . . . . . . . . . . . . . . . . . H. Joseph Newton and N.
J. Cox
http://www.stata.com/bookstore/tips.html
It seems that there are still some people who have yet to buy the
latter! (I get no royalties, so have complete neutrality here.)
On Martin's question of "should", there is room for disagreement.
Stata's default of allowing variable abbreviations is well documented,
even though it would be a rare user who had not occasionally been bit by
its consequences.
However, if you want that safety you could set up your own analogue of
-rename- with such protection. It could -set varabbrev on- temporarily
if it was off. Or it could be a variant on -safedrop- from SSC.
Nick
[email protected]
Martin Weiss
I am currently dealing with a nasty problem. Try the following:
**********
clear*
set obs 100
g x14 = 0
g x2=5
rename x1 x90
**********
The last -rename- simply hijacks variable x14 and renames it x90. If I
wanted this behavior, I would say -rename x1? X90-. Should -rename- not
alert me to the fact that there is no such variable?
*
* 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/