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: total() returns zero if all missing in long-format data


From   Maarten Buis <maartenlbuis@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: total() returns zero if all missing in long-format data
Date   Mon, 29 Oct 2012 14:32:17 +0100

On Mon, Oct 29, 2012 at 2:19 PM, Shehzad Ali <drshehzad_ali@yahoo.com> wrote:
> In long-format data structure (multiple obs per id), the total() function returns zero if all values of the variable for a particular id are missing. Can anyone suggest the best way to ensure that the total returns missing when all values are missing for a particular id?
>
> bysort id: egen total = total(var1)

The answer is in the helpfile of -egen-.

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