Statalist


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

st: Re: Summing variables by row


From   "Leonor Saravia" <[email protected]>
To   [email protected]
Subject   st: Re: Summing variables by row
Date   Tue, 16 Sep 2008 10:29:48 -0400

Hello,

I want to thank you all for your help!
Well, what I wanted to do was to sum the variables by row (I'm working
with Stata 9) so I used  - egen, rowtotal -. My problem was that  -
egen, rowtotal - treats the missing values as 0, but I needed to have
a number,  given by the sum of the variables even though there was a
missing value,  and to have a missing value when there was no number
in the variables (only missings).

Thank you again,

Leonor


2008/9/15, Leonor Saravia <[email protected]>:
> 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/



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