Statalist


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

st: RE: Summing variables by row


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

************
sysuse auto, clear
egen float rtot = rowtotal(price mpg rep78)
inspect rtot
egen float rmiss = rowmiss(price mpg rep78)
inspect rmiss
replace rtot=. if rmiss>0
l rtot price mpg rep78
************



HTH
Martin




-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Leonor Saravia
Sent: Monday, September 15, 2008 2:33 PM
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/



*
*   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