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

RE: st: RE: scalar troubles?

From   "Nick Cox" <>
To   <>
Subject   RE: st: RE: scalar troubles?
Date   Wed, 5 Nov 2003 16:26:59 -0000

Let's keep two issues distinct: 

1. variable -foo-, scalar -foo- both exist: 

. di foo 

goes for the variable. Well, that's history
and politics, I guess. Variables came first in 
Stata's history; variables
get "more votes" than scalars from users.  
The original question was within a program, 
but the rule has to be the same interactively 
as well. 

2. If -foo- is a variable, then 

. di foo 

is equivalent to 

. di foo[1] 

The reaction against 2 stems -- at least partly -- from the 
feeling that Stata shouldn't do what the user doesn't 
really want it to do, i.e. that no user would really 
attempt to display a whole variable in this way. 
But consider two details then arising: 

* The parser goes on what is legal, not what is 
sensible or meaningful. It is very difficult to 
design a language making it impossible for the 
user never to say things that are not sensible, 
not least because what is sensible can be very 
difficult to pin down.  

* It is perfectly legal to have a variable with just
one observation, in which case -di foo- is totally 
sensible. Not common, sure; but perfectly legal. 

These two comments are at most part of the story; 
no doubt more can be said. 


> -----Original Message-----
> From:
> []On Behalf Of 
> Edwin Leuven
> Sent: 05 November 2003 16:11
> To:
> Subject: Re: st: RE: scalar troubles?
> > (This applies not just to -display-, but to any context 
> that refers to a 
> > single value, rather than the whole dataset's set of values.)
> > 
> > I also find it odd, and have never found it useful.  Does 
> anyone find it 
> > useful? I would not have designed it that way, and have 
> always found it 
> > to be a potential source of error rather than a convenience.
> default behavior which uses the scalar seems more logical 
> indeed, but 
> perhaps the current default is well argued (although i 
> can't see how)
> edwin
> *
> *   For searches and help try:
> *
> *
> *
*   For searches and help try:

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