Date: Fri, 10 Sep 2010 08:19:23 -0700
Reply-To: "Terjeson, Mark" <Mterjeson@RUSSELL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Terjeson, Mark" <Mterjeson@RUSSELL.COM>
Subject: Re: Can I rename only one variable in a long proc summary var
list?
In-Reply-To: A<109838.40508.qm@web112502.mail.gq1.yahoo.com>
Content-Type: text/plain; charset="us-ascii"
Hi Dave,
When you say "I just thought of the rename option.
I was hoping to do it all in the proc.", the RENAME
does sound like what you want, but I am unclear if
you know that you can do the RENAME in the PROC, or
at least at the end-of-the-PROC. You can combine
dataset modifiers on the incoming dataset or the
outgoing dataset. Also, in the PROC you can specify
the destination aggregation variable names in the
SUM= instead of using the /noinherit.
e.g.
proc summary nway data=pulldata;
class id1 id2 id3 id4 id4 id6 id7 id8 id9;
var var1amt var2amt var3amt var4amt
var5amt var6amt var7amt var8amt
var9amt
output out=pullsum(rename=(var6amt=der_var6amt)
drop=_:) sum=/noinherit;
run;
Hope this is helpful.
Mark Terjeson
Investment Business Intelligence
Investment Management & Research
Russell Investments
253-439-2367
Russell
Global Leaders in Multi-Manager Investing
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
dave crimkey
Sent: Friday, September 10, 2010 8:05 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: Can I rename only one variable in a long proc summary var
list?
I just thought of the rename option. I was hoping to do it all in the
proc. I
don't really need to keep var6amt. I guess what I was looking for was
something
like you can do in SQL -- like a case statement in the middle of a
select/sum/group by to rename the variable you're summing.
________________________________
From: Joe Matise <snoopy369@gmail.com>
To: dave crimkey <d_crimkey@yahoo.com>
Cc: SAS-L@listserv.uga.edu
Sent: Fri, September 10, 2010 10:49:10 AM
Subject: Re: Can I rename only one variable in a long proc summary var
list?
Not sure I completely follow what you mean by 'also keep var6amt', but
you
should be able to either use data set options in the out= statement, or
do a
rename in PROC DATASETS or somewhere else, if you want to just rename
one of
them.
-Joe
On Fri, Sep 10, 2010 at 9:45 AM, dave crimkey <d_crimkey@yahoo.com>
wrote:
I have a proc summary that looks like this (variable names renamed to
protect
>the innocent):
>
>proc summary nway data=pulldata;
> class id1 id2 id3 id4 id4 id6 id7 id8 id9;
> var var1amt var2amt var3amt var4amt
> var5amt var6amt var7amt var8amt
> var9amt
> output out = pullsum (drop=_:) sum=/noinherit;
>run;
>
>I want all the varamt field names to remain the same except var6amt. I
want to
>rename that amt field to der_var6amt but keep var6amt also. Is there a
way to
>do this in the sum= statement without listing all the var names? So my
pullsum
>dataset will contain:
>
>id1 id2 id3 id4 id4 id6 id7 id8 id9 var1amt var2amt var3amt var4amt
> var5amt var6amt der_var6amt var7amt var8amt
> var9amt
>
>Thanks for your help,
>Dave
>