# Re: st: RE: Summing variables by row

 From "Ashim Kapoor" <[email protected]> To [email protected] Subject Re: st: RE: Summing variables by row Date Mon, 15 Sep 2008 19:12:46 +0530

```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 problems, please call your organisation's IT Helpdesk.
>> 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=x1C3Zw
>>
>> 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/
```