<>
" Forgot to add some all important information"
Stata 11 still uses the same -collapse- version, so never mind...
HTH
Martin
-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Neil Shephard
Gesendet: Freitag, 2. Oktober 2009 14:31
An: [email protected]
Betreff: Re: st: -collapse- with no observations?
Forgot to add some all important information...
. about
Stata/SE 10.1 for Windows
Born 18 Aug 2009
Copyright (C) 1985-2009
<-- snip-->
. version
version 10.1
. which collapse
P:\Stata10\ado\updates\c\collapse.ado
*! version 6.1.2 24oct2008
On Fri, Oct 2, 2009 at 11:30 AM, Neil Shephard <[email protected]> wrote:
> Hi,
>
> I've encountered some unexpected behaviour whilst using -collapse- on
> different subsets of data. An example to demonstrate the problem....
>
> sysuse auto, clear
> sum price
> collapse (count) n = mpg if(price < 2000)
>
> This results in an error as there are no cars with price < 2000...
>
> . sysuse auto, clear
> (1978 Automobile Data)
>
> . sum price
>
> Variable | Obs Mean Std. Dev. Min Max
> -------------+--------------------------------------------------------
> price | 74 6165.257 2949.496 3291 15906
>
>
> . collapse (count) n = mpg if price < 2000
> no observations
> r(2000);
>
> I would have expected the command to run and return a count of zero
> (0) as this is a valid number of counts (to my mind at least).
>
> There's a mention at http://www.stata.com/help.cgi?whatsnew10 that
> indicates that trying to open the data editor with an if qualifier
> that resulted in zero observations used to cause Stata to crash, but
> that has been fixed.
>
> Searching the archives/FAQ I haven't been able to find whether this
> has has been discussed before, or is a reasonable behaviour (as I say
> I would have expected to get a count of zero returned).
>
> Neil
>
> --
> "The combination of some data and an aching desire for an answer does
> not ensure that a reasonable answer can be extracted from a given body
> of data." ~ John Tukey (1986), "Sunset salvo". The American
> Statistician 40(1).
>
> Email - [email protected]
> Website - http://slack.ser.man.ac.uk/
> Photos - http://www.flickr.com/photos/slackline/
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
>
--
"The combination of some data and an aching desire for an answer does
not ensure that a reasonable answer can be extracted from a given body
of data." ~ John Tukey (1986), "Sunset salvo". The American
Statistician 40(1).
Email - [email protected]
Website - http://slack.ser.man.ac.uk/
Photos - http://www.flickr.com/photos/slackline/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/