| Date: | Fri, 19 Feb 2010 01:27:40 -0800 |
| Reply-To: | Amar Mundankar <amarmundankar@GMAIL.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Amar Mundankar <amarmundankar@GMAIL.COM> |
| Organization: | http://groups.google.com |
| Subject: | Re: SUM the values |
|
| Content-Type: | text/plain; charset=ISO-8859-1 |
Hi,
Is this what you want??
data have;
input var $ val;
cards;
a 1
a 2
a 3
b 4
b 5
b 6
c 7
c 8
c 9
;
data want(drop = );
set have;
by var;
retain new_val;
if first.var then
new_val = val;
else
new_val = new_val + val;
run;
proc print;
run;
Thanks and Regards,
Amar Mundankar.
On Feb 19, 1:08 pm, peesari.mah...@GMAIL.COM ("SUBSCRIBE SAS-L Joe H.
Smith") wrote:
> Hi all,
>
> i have data like this
> a 1
> a 2
> a 3
> b 4
> b 5
> b 6
> c 7
> c 8
> c 9
>
> Output i need this way
>
> a 1 1
> a 2 3
> a 3 5
> b 4 4
> b 5 9
> b 6 15
> c 7 7
> c 8 15
> c 9 24
>
> any ideas please.
>
> thanks a lot
|