Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[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
Shehzad Ali <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: total() returns zero if all missing in long-format data
Date
Tue, 30 Oct 2012 07:41:57 +0000 (GMT)
Thanks, Nick and Maarten. Spot on, as always. -total(), missing- works perfect.
Thanks
Shehzad
P.S. Sorry for the delay in replying - my email update was delayed.
----- Original Message -----
> From: Nick Cox <[email protected]>
> To: [email protected]
> Cc:
> Sent: Monday, 29 October 2012, 14:11
> Subject: Re: st: total() returns zero if all missing in long-format data
>
> Maarten is as usual completely correct.
>
> There is some discussion of summing missings in
>
> SJ-10-1 dm0047 . . . . . . . . . . . . . . . . Stata tip 84: Summing missing
> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox
> Q1/10 SJ 10(1):157--159 (no commands)
> tip concerning treatment of missing data when summing
>
> Nick
>
> On Mon, Oct 29, 2012 at 1:32 PM, Maarten Buis <[email protected]>
> wrote:
>> On Mon, Oct 29, 2012 at 2:19 PM, Shehzad Ali
> <[email protected]> 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-.
>
> *
> * 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/
>
*
* 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/