|
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: RE: Summing variables by row
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/