# RE: st: RE: Summing variables by row

 From "Martin Weiss" <[email protected]> To <[email protected]> Subject RE: st: RE: Summing variables by row Date Mon, 15 Sep 2008 15:59:14 +0200

```Well, maybe that is true, Leonor should clarify this point. The initial post
displays the table at the bottom in such a way that makes it hard to tell...

Martin

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Ashim Kapoor
Sent: Monday, September 15, 2008 3:52 PM
To: [email protected]
Subject: Re: st: RE: Summing variables by row

I thought we wanted to make the result mi if the entire row was mi ? no ?

On Mon, Sep 15, 2008 at 7:15 PM, Martin Weiss
<[email protected]> wrote:
> That is besides the point because -egen, rowtotal- treats missings as 0
> anyway. The point of the initial post was that we wanted a missing if any
of
> the observations being summed was missing.
>
>
>
>
> HTH
> Martin
>
>
>
>
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Ashim Kapoor
> Sent: Monday, September 15, 2008 3:43 PM
> To: [email protected]
> Subject: Re: st: RE: Summing variables by row
>
> I meant if var`i'==.
>
> On Mon, Sep 15, 2008 at 7:06 PM, Ashim Kapoor <[email protected]>
wrote:
>> Ummm Why can't I simply do replace var`i'=0 if var`i'==0 for all i and
>> then do the rowtotal?
>>
>> On Mon, Sep 15, 2008 at 6:19 PM, Williams, Rachael
>> <[email protected]> wrote:
>>> Hi Leonor,
>>>
>>> I've always done this in a slightly roundabout way by calculating a
> -rowtotal- and a -rowmiss- (or -rownonmiss- of course)
>>> Then you can do something like -replace total = . if rownmiss == 0-.
>>>
>>> If someone else has a better way of doing this, I'd love to hear too!
>>> Rachael
>>>
>>> -----Original Message-----
>>> From: [email protected]
> [mailto:[email protected]] On Behalf Of Leonor Saravia
>>> Sent: 15 September 2008 13:33
>>> To: [email protected]
>>> Subject: st: Summing variables by row
>>>
>>> Hello Statalisters,
>>>
>>> I�m trying to sum many variables by row using the -rowtotal - function.
> The problem is that I need to distinguish when the resultant sum is cero
or
> a missing value. Do you know if there�s another command or function that
may
> sum by varlist and mantain the missing values when they are present?
>>>
>>> I�d like to generate a variable 'total' like this:
>>>
>>> var1 var 2 var3......varN  total
>>> .       0      .           .        0
>>> 1      .       .           .        1
>>> .       .       .           .        .
>>> 0      1      .           1        2
>>> .
>>> .
>>> .
>>> 1      0    0             1       2
>>>
>>>
>>> Thank you very much!
>>>
>>> Leonor
>>>
>>> *
>>> *   For searches and help try:
>>> *   http://www.stata.com/help.cgi?search
>>> *   http://www.stata.com/support/statalist/faq
>>> *   http://www.ats.ucla.edu/stat/stata/
>>>
>>> This email was received from the INTERNET and scanned by the Government
> Secure Intranet anti-virus service supplied by Cable&Wireless in
partnership
> with MessageLabs. (CCTM Certificate Number 2007/11/0032.) In case of
>>> Communications via the GSi may be automatically logged, monitored and/or
> recorded for legal purposes.
>>>
>>> This email and any files transmitted with it are confidential. If you
are
> not the intended recipient, any reading, printing, storage, disclosure,
> copying or any other action taken in respect of this email is prohibited
and
> may be unlawful.
>>>
>>> If you are not the intended recipient, please notify the sender
> immediately by using the reply function and then permanently delete what
you
> have received.Incoming and outgoing email messages are routinely monitored
> for compliance with the Department of Healths policy on the use of
> electronic communications.
>>>
>>> For more information on the Department of Healths email policy, click
>>>
>
http://www.dh.gov.uk/DHTermsAndConditions/fs/en?CONTENT_ID=4110945&chk=x1C3Z
> w
>>>
>>> The original of this email was scanned for viruses by the Government
> Secure Intranet virus scanning service supplied by Cable&Wireless in
> partnership with MessageLabs. (CCTM Certificate Number 2007/11/0032.) On
> leaving the GSi this email was certified virus free.
>>> Communications via the GSi may be automatically logged, monitored and/or
> recorded for legal purposes.
>>>
>>> *
>>> *   For searches and help try:
>>> *   http://www.stata.com/help.cgi?search
>>> *   http://www.stata.com/support/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/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/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/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/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```