Date: Mon, 18 Nov 2002 23:08:36 -0500
Reply-To: Howard_Schreier@ITA.DOC.GOV
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Howard_Schreier@ITA.DOC.GOV
Subject: Re: Rename
Another technique, which may be useful if for some reason you do not want
to permanently rename the variable, is to create a DATA step view which
applies the new name. Something like:
data truenew_rename / view=truenew_rename;
set truenew;
rename cust_num = newcusno;
run;
On Mon, 18 Nov 2002 16:17:13 -0500, Lu Liu <Lu.Liu@TALBOTS.COM> wrote:
>Floyd,
>
>Before the merge, TRUENEW dataset has 2 variables - OLDCUSNO and CUST_NUM;
>OLDNEWID dataset also has 2 variables - OLDCUSNO and NEWCUSNO. I used the
>following merge statement to create a new dataset TRUENEW2 with OLDCUSNO
and
>NEWCUSNO. But what about TRUENEW dataset after renaming the variable
>CUST_NUM? Does TRUENEW dataset have OLDCUSNO and NEWCUSNO variables now or
>still have OLDCUSNO and CUST_NUM? I will use TRUENEW dataset again later
in
>the program so it is important for me to know the correct variable names in
>the dataset.
>
>DATA TRUENEW2;
> MERGE TRUENEW (IN=A RENAME=(CUST_NUM=NEWCUSNO))
> OLDNEWID;
> BY NEWCUSNO;
> IF A;
>RUN;
>
>Hope this clarifies my question.
>
>Thank you very much in advance.
>Lu
>
>-----Original Message-----
>From: Nevseta, Floyd G [mailto:Floyd.G.Nevseta@bankofamerica.com]
>Sent: Monday, November 18, 2002 2:37 PM
>To: 'Lu Liu'; SAS-L@LISTSERV.UGA.EDU
>Subject: RE: Rename
>
>
>Using the data set option, RENAME, on an input data set does, indeed,
rename
>the variable before processing begins. In fact, your BY statement is
>counting on it.
>
>I suspect you are having a problem. Share with us specifically what is
>happening (or not) in your code.
>
>Regards,
>Floyd
>
>-----Original Message-----
>From: Lu Liu [mailto:Lu.Liu@TALBOTS.COM]
>Sent: Monday, November 18, 2002 1:27 PM
>To: SAS-L@LISTSERV.UGA.EDU
>Subject: Rename
>
>
>My question is after running the following statement, which variable should
>be in TRUENEW dataset: CUST_NUM or NEWCUSNO? I had always thought it
should
>be the NEWCUSNO as CUST_NUM has been renamed, but when running a program I
>am working on now, I think I was wrong. But I would like ask to confirm.
>
>
>DATA TRUENEW2;<?xml:namespace prefix = o ns =
>"urn:schemas-microsoft-com:office:office" />
>
> MERGE TRUENEW (IN=A RENAME=(CUST_NUM=NEWCUSNO))
>
> OLDNEWID;
>
> BY NEWCUSNO;
>
> IF A;
>
> RUN;
>
>
>
>Your assistance is greatly appreciated.
>
>
>
>Lu
|