Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: RE: Summing variables by row


From   "Martin Weiss" <martin.weiss@uni-tuebingen.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: RE: Summing variables by row
Date   Mon, 15 Sep 2008 15:45:39 +0200

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: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Ashim Kapoor
Sent: Monday, September 15, 2008 3:43 PM
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: RE: Summing variables by row

I meant if var`i'==.

On Mon, Sep 15, 2008 at 7:06 PM, Ashim Kapoor <ashimkapoor@gmail.com> 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
> <Rachael.Williams@mhra.gsi.gov.uk> 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: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Leonor Saravia
>> Sent: 15 September 2008 13:33
>> To: statalist@hsphsun2.harvard.edu
>> Subject: st: Summing variables by row
>>
>> Hello Statalisters,
>>
>> Im 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 theres another command or function that may
sum by varlist and mantain the missing values when they are present?
>>
>> Id 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=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/



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