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

st: new command -checkfor2-


From   Kit Baum <[email protected]>
To   [email protected]
Subject   st: new command -checkfor2-
Date   Mon, 19 Sep 2005 14:10:40 -0400

Amadou said

Nick, from my point of view, it is easier to type:
nmissing x
than:
count if x == .

Easier, and nmissing (appropriately updated) gives the right answer, which count does not...

Note that the count statement as given does not tell you how many missing values there are; it tells you how many are equal to ".". There are 27 kinds of missing values in Stata, and if you want to trap all of them,

count if !(x<.)

is needed:

. tab rep78,missing

Repair |
Record 1978 | Freq. Percent Cum.
------------+-----------------------------------
1 | 2 2.70 2.70
2 | 8 10.81 13.51
3 | 29 39.19 52.70
4 | 18 24.32 77.03
5 | 11 14.86 91.89
. | 4 5.41 97.30
.a | 1 1.35 98.65
.b | 1 1.35 100.00
------------+-----------------------------------
Total | 74 100.00

. count if rep78 == .
4

. count if !(rep78<.)
6


Kit Baum, Boston College Economics
http://ideas.repec.org/e/pba1.html


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