Date: Tue, 14 Apr 2009 06:56:44 -0700
Reply-To: Sandro <sandro.saitta@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Sandro <sandro.saitta@GMAIL.COM>
Organization: http://groups.google.com
Subject: Re: Summing columns from two data sets
Content-Type: text/plain; charset=ISO-8859-1
Thanks for the help!
Sandro.
On Apr 14, 1:03 pm, procconte...@GMAIL.COM (SAS_learner) wrote:
> hello sandro,
>
> You need to merge those datasets either using Merge statement or Join them
> using Proc Sql and them use sum statement . As I do not how your data looks
> like something like
>
> SAS Datastep Method:
>
> Proc Sort data = a ; By <Key var>;Run;
> Proc Sort data = b ; By <Key var>;Run;
>
> Data a_and_b ;
>
> Merge a (in = _a ) b (in = _b);
> By <Key Var>;
> If b;
> Sum_col1_Col2 = Sum(Col1,Col2);
> Run;
>
> Proc Sql Method :
>
> Proc Sql Noprit ;
> Select a.key_var , B.*, Sum(col1,Col2) as Sum_col1_Col2
> from a as a b as b
> where a.Key_Var = b.Key_Var ;
> Quit ;
>
> Something like that might help
>
> thanls
> SL
>
> On Tue, Apr 14, 2009 at 6:54 AM, Sandro Saitta <sandro.sai...@gmail.com>wrote:
>
> > Hello,
>
> > In SAS Base, I would like to sum a column from table A with a column
> > from table B and put the result in table B. Both columns are numbers.
> > I have tried with UPDATE in a DATA step but I can't find a way to do
> > it.
>
> > Does anyone have an idea?
>
> > Kind regards.
> > Sandro.
|