Statalist


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

st: sum of missing values returned as zero


From   Jacob Wegelin <[email protected]>
To   [email protected]
Subject   st: sum of missing values returned as zero
Date   Fri, 3 Oct 2008 18:44:51 -0400 (EDT)

The following code

clear set obs 4
gen Finished=.
list
summarize Finished
return list

returns a value of zero for the sum of Finished, as is seen below. I do not understand. I would think that the sum of a list of numbers, at least one of which is missing, would be missing, not zero. Can someone explain?

. set obs 4
obs was 0, now 4

. gen Finished=.
(4 missing values generated)

. list

+----------+
| Finished |
|----------|
1. | . |
2. | . |
3. | . |
4. | . |
+----------+

. summarize Finished

Variable | Obs Mean Std. Dev. Min Max
-------------+--------------------------------------------------------
Finished | 0

. return list

scalars:
r(N) = 0
r(sum_w) = 0
r(sum) = 0


Thanks

Jacob A. Wegelin
[email protected] Assistant Professor
Department of Biostatistics
Virginia Commonwealth University
730 East Broad Street Room 3006
P. O. Box 980032
Richmond VA 23298-0032
U.S.A. http://www.people.vcu.edu/~jwegelin

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




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