s-news
[Top] [All Lists]

Addition of values with NAs

To: "'s-news@lists.biostat.wustl.edu'" <s-news@lists.biostat.wustl.edu>
Subject: Addition of values with NAs
From: "D.Kaufmann" <dka@suisag.ch>
Date: Tue, 20 Feb 2001 19:04:57 +0100
Hi,

I am using SPlus 2000 Professional on Windows NT4.0. My data frame contains
5 columns:

MAf     MBr     MCh     MFr     MSp
2       0       1       0       0
0       0       0       0       NA
0       1       0       3       NA

Now I want to insert a new column (M) which contains the sum of the values
in these 5 columns. 

MAf     MBr     MCh     MFr     MSp     M
2       0       1       0       0       3
0       0       0       0       NA      NA
0       1       0       3       NA      NA

My problem is now, that the sum of the values in these 5 columns is NA, if
one of these 5 columns contains a value=NA. How can I get the sum of these 5
values if at least one column contains a value? 

Thanks for your answers.

Daniel Kaufmann

SUISAG
Allmend
6204 Sempach
Switzerland

Tel: +41-41-462 65 53
Fax: +41-41-462 65 49
Email: dka@suisag.ch


<Prev in Thread] Current Thread [Next in Thread>
  • Addition of values with NAs, D.Kaufmann <=