|
You can do it all in the proc. :)
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=_: rename=var6amt=der_var6amt) sum=/noinherit;
run;
-Joe
On Fri, Sep 10, 2010 at 10:04 AM, dave crimkey <d_crimkey@yahoo.com> wrote:
> 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
>>
>
>
>
|