Date: Fri, 7 Sep 2001 10:32:15 -0400
Reply-To: "Droogendyk, Harry" <Harry.Droogendyk@CIBC.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Droogendyk, Harry" <Harry.Droogendyk@CIBC.COM>
Subject: Re: Simple totaling
Content-Type: text/plain; charset="iso-8859-1"
Shireen:
If ANY of the accumulators is missing, tot will be missing. Use the SUM
function instead:
tot = sum(m1,m2,m3,m4);
-----Original Message-----
From: shireen p [mailto:shireenp@HOTMAIL.COM]
Sent: September 7, 2001 10:25 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Simple totaling
Hi,
This is a very simple problem but I am unable to find a fast solution. Any
help is appreciated.
Consider this file
rep m1 m2 m3 m4 m5 m6 m7
1 6 . . . . . .
2 . 9 . . . . .
3 . . 7 . . . .
4 . . . 4 . . .
--
data a;
retain tot 0;
tot=tot+m1;
tot=tot+m2;
tot=tot+m3;
tot=tot+m4;
output data a;
run;
proc print data=a;
run;
How can I have a variable TOT such that TOT=m1+m2+m3+m4; Here TOT is the
cumulative of all 4 records.
For some reason all I get is a missing value.
What am I doing wrong. thank you.
Shireen
_____
Get your FREE download of MSN Explorer at http://explorer.msn.com
<http://go.msn.com/bql/hmtag_itl_EN.asp>
|