Date: Tue, 22 Jun 2004 11:56:59 -0700
Reply-To: "Schwarz, Barry A" <barry.a.schwarz@BOEING.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Schwarz, Barry A" <barry.a.schwarz@BOEING.COM>
Subject: Re: Help with By group processing, thanks
Content-Type: text/plain; charset="iso-8859-1"
Not a great solution but you can add the following to your code:
PROC SORT data=gettotal;
BY inst DESCENDING totfund;
RUN;
DATA fixtotal (DROP newtot);
RETAIN newtot;
SET gettotal;
BY inst;
IF FIRST.inst THEN
newtot = totfund;
ELSE
totfund = newtot;
RUN;
-----Original Message-----
From: SAS L [mailto:sasluser@YAHOO.COM]
Sent: Tuesday, June 22, 2004 6:30 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Help with By group processing, thanks
Hey, all:
I am having some problem with a by - group processing, or you may have some alternatives to solve this problem.
Run this program below you will get:
inst fund totfund
FDA 4 4
FDA 41 45
FDA 3 48
HIB 10 10
NCI 5 5
NIH 4 4
NIH 50 54
and what I eventually want is something like this:
inst fund totfund
FDA 4 48
FDA 41 48
FDA 3 48
HIB 10 10
NCI 5 5
NIH 4 54
NIH 50 54
Thank you very much!!!!!!!
SCh
data ttotal;
input inst $ fund;
cards;
FDA 4
FDA 41
FDA 3
NIH 4
NIH 50
NCI 5
HIB 10
;
run;
proc sort data = ttotal out = ttotalsorted;
by inst;
run;
data gettotal;
set ttotalsorted;
by inst;
if first.inst then totfund = 0;
totfund + fund;
*if last.inst;
run;
proc print data = gettotal;
run;
---------------------------------
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!