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

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


From   Glen Waddell <[email protected]>
To   [email protected]
Subject   st: RE: RE: Referring to a varname, leading to errors
Date   Tue, 11 Feb 2003 10:06:33 -0800

I suppose the quick reply is, bummer.  

There is certainly a place for abbreviated command names.  My example
with respect to varnems, however, is intentionally simple.  One must
recognize that this issue can lead to costly down time when mistakes are
made and must be tracked down.  Abbreviated varnames just doesn't seem
worth it, and clicking on the varname doesn't help when running
do-files.

- Glen



-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Nick Cox
Sent: Tuesday, February 11, 2003 1:33 AM
To: [email protected]
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 
[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/


*
*   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