LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (April 2004, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 26 Apr 2004 10:09:59 -0400
Reply-To:     Michael Whitcomb <mwhitcomb@WESLEYAN.EDU>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Michael Whitcomb <mwhitcomb@WESLEYAN.EDU>
Subject:      RENAME and KEEP in one data step
Comments: To: SAS-L@LISTSERV.VT.EDU
Content-Type: text/plain; charset="us-ascii"; format=flowed

A question/curiosity about using the RENAME and KEEP statements in the same data step. Rather by accident I discovered that the RENAME statement can follow either the DATA statement :

data two (RENAME = (oldvar = newvar)); set one; keep OLDVAR; run;

or in the SET line:

data two; set one (rename = (oldvar = newvar ));; keep NEWVAR; run;

*But* the location of the RENAME statement determines whether one must specify the OLDVAR or NEWVAR in the subsequent KEEP statement. Perhaps this coding is kludge - I am curious if there is a best practice for renaming variables and then keeping these variables in the same data step and why the RENAME can go in either location but then influences how one KEEPs these variables. Oh, and please no PROC SQL solutions because I am doing other computations in this datastep.

TIA,

Michael Whitcomb


Back to: Top of message | Previous page | Main SAS-L page