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

st: RE: Re: ST: sum over observations

From   "Nick Cox" <>
To   <>
Subject   st: RE: Re: ST: sum over observations
Date   Tue, 8 Feb 2005 17:50:12 -0000

. nmissing, min(80) 

lists only those variables with 80 or more 
missing values. This option has been there
since the first version. This appears to 
be what you want. 

What it doesn't do is save the list 
as a macro. That can be done with recourse
to those elusive first principles: 

foreach v of var * { 
	qui count if mi(`v') 
	if r(N) >= 80 local badlist "`badlist'`v' " 
di "`badlist'" 


Eric Uslaner
> I have a very large data set with about 2000 variables.  
> Periodically I
> want to examine which variables have missing values on the 
> fewest number
> of cases.  I use sum or fsum but this requires lisitng all of the
> variables.  Suppose, for a data set of 101 cases, I wish to find out
> which variables have 80 or more cases.  I would like something like:
> sum if (number of cases) >= 80
> I know that nmissing can do this, but it too lists all of the
> variables.  And the number of variables is too large to create a new
> variable for the number of missing (or nonmissing) cases for each
> variable.  Any suggestions?  Many thanks.

*   For searches and help try:

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