[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: the -missing- command
Thanks, Jeff and Michael, for the very helpful replies.
From: firstname.lastname@example.org (Jeff Pitblado, StataCorp LP)
louis boakye-yiadom <email@example.com> asks about the -missing()-
> I have two questions regarding the -missing- command (or function?).
> First question:
> I'm not clear about exactly what -missing- does. An example will clarify
> concern. I have a dataset containing 11 variables (the first is -clust-
> the last is -s11aq13-). One of the variables is -trexpcd-, and the total
> number of observations is 4872. I gave the following commands and had
> shown output:
> count if mi(trexpcd)
> count if mi(clust-s11aq13)
> My understanding of the online -help- is that -missing- evaluates the
> of observations for which any of the arguments is missing. So, for the
> second command, since -trexpcd- is one of the arguments, I expected the
> result to be a number which is at least equal to 4649.
> Can anyone please show me what I'm missing?
> Second question:
> Also, I had the following result:
> count if !mi(clust-s11aq13)
> Does !mi() evaluate the number of observations for which none of the
> arguments is missing? Thank you.
I believe what Louis wants is Nick Cox's -nmissing- command, which (among
other things) reports the number of missing values found in the variable of
. ssc install nmissing
. sysuse auto
(1978 Automobile Data)
There is also a companion command called -npresent- that reports the number
non-missing values found in each variable of the dataset:
Also, look into the -mark- and -markout- commands. They help you generate
variable that indicates observations that are free of missing values for a
specified list of variables:
. mark touse
. markout touse price-foreign
. count if touse
Svend Juul <SJ@SOCI.AU.DK> also replied and was puzzled by the results of
. count if missing(rep78-headroom)
. count if missing(mpg-headroom)
-missing()- is a function, in this context "rep78-headroom" is interpreted
to mean the difference between the variables -rep78- and -headroom-.
* For searches and help try: