[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"Dupont, William" <william.dupont@Vanderbilt.Edu> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: RE: Referring to a varname, leading to errors |

Date |
Tue, 11 Feb 2003 13:39:00 -0600 |

That is a pity. It certainly would be useful if there was a command that we could invoke to forbid the use of variable abbreviations. -----Original Message----- From: Nick Cox [mailto:n.j.cox@durham.ac.uk] Sent: Tuesday, February 11, 2003 3:33 AM To: statalist@hsphsun2.harvard.edu Subject: st: RE: Referring to a varname, leading to errors Glwn Waddell > > This is one of those problems that only arises out of human error. > Nonetheless, Stata is set up to allow this mistake to go unchecked. > Consider the following example... > > Suppose a variable currently exists with the name "abcdefg" and one > wants to condition on a different variable, abcde, such that one runs > a command only for abcde == 1. If abcde has not been created > (i.e. human > error, the creation of this variable having been overlooked), the > command "reg y1 x1 x2 if abcde == 1" would actually be run > conditional > on abcdefg == 1, not abcde == 1. > > I suppose the idea behind allowing shortened varnames is one of > convenience. However, this seems like more trouble than it is worth. > Is there a way to toggle between allowing such shortened > names and not? > A permanent fix would be even better. > We can argue over whether allowing abbreviated varnames -- or indeed abbreviated command names -- was a design mistake, and when the feature bites you, you certainly think it may have been. However, this example does not seem that scary. A habit of clicking on variable names in the Variables window can help in this circumstance. In general, Pandora -- or more precisely Bill Gould -- opened the box many years ago, and I don't think that act can be reversed. I don't think there is a completely general way of setting Stata to acting if and only if variable names supplied are the unabbreviated versions. There are solutions to specific problems, e.g. you can write a program to -drop- what you specify if and only if what you name includes complete variable names. -drop-ping something important by accident can be an issue. It's not your question, but I'm reminded that some years ago someone suggested that Stata programmers should not be allowed to abbreviate command names, because it made programs more difficult for beginners to understand, so that every program should only include full command names. That didn't get any support from programmers. Nick n.j.cox@durham.ac.uk * * 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/

- Prev by Date:
**st: RE: RE: RE: RE: Referring to a varname, leading to errors** - Next by Date:
**st: combining many -twoway (histogram)- graphs** - Previous by thread:
**st: RE: RE: RE: RE: Referring to a varname, leading to errors** - Next by thread:
**st: RE: RE: Referring to a varname, leading to errors** - Index(es):

© Copyright 1996–2014 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |