Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: recording the first/last non-missing/missing values position


From   Maarten Buis <maartenlbuis@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: recording the first/last non-missing/missing values position
Date   Mon, 5 Nov 2012 09:23:43 +0100

On Sun, Nov 4, 2012 at 8:19 PM, Qunzi Zhang wrote:
> The final goal is to count the nr. non-missing values

number of missing values on varname1, varname2, varname3, etc. in the
entire dataset:

count if missing(varname1, varname2, varname3, etc.)

number of missing values on varname1, varname2, etc. by some grouping
variable (id).

gen byte miss = missing(varname1, varname2, etc.)
bysort id : egen nmiss = total(nmiss)
drop miss

-- Maarten

---------------------------------
Maarten L. Buis
WZB
Reichpietschufer 50
10785 Berlin
Germany

http://www.maartenbuis.nl
---------------------------------
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index