LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (January 2001, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 9 Jan 2001 23:41:35 -0500
Reply-To:     Richard DeVenezia <radevenz@IX.NETCOM.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Richard DeVenezia <radevenz@IX.NETCOM.COM>
Organization: MindSpring Enterprises
Subject:      Re: Renaming variables in PROC SQL

Rename=() is a data set option that can be used with input or output data sets and is not standard SQL. For 'standard' SQL use <expression> as <column-name> in your select.

e.g. select ... state as region

select ... region ... from ~~~~ (rename=(state=region))

create ~~~ (rename=(state=region)) as select ... state ... from ~~~~

Note: renaming a variable in a FROM data set that is a good candidate for index usage in a join will cause the SQL system to be unable to locate the variable's new name in the index table and hence not use it.(at least, that is what happens in V6).

-- Richard DeVenezia - SAS Macros and AF Tools GreenBar model scl for viewtable - http://www.devenezia.com/downloads/sas/common/greenbar/

"Paula Sims" <paulasims@my-deja.com> wrote in message news:93f8j1$nvn$1@nnrp1.deja.com... > I am using PROC SQL (actually, it's PROC DB2EXT) on the mainframe in > batch mode and was wondering if I can use the RENAME option in my SELECT > statement. I usually rename after my WHERE clause and before the RUN, > but when I tried it in my select statement (as I would in regular SQL) I > would get an error. > > The options I tried are > > Select ID, > NAME, > CITY, > STATE (Rename = (State = Region)) > FROM ~~~~~~ > > > and > > Select ID, > NAME, > CITY, > STATE as 'REGION' > FROM ~~~~~~ > > > > Can renaming be done within the select statement or must it be done > outside the PROC? > > In addition, when I do rename outside the PROC, if I use > RENAME STATE = REGION > I get an error stating that it is looking for a numeric equivolent, > namely > RENAME 4 = REGION. > > As you can tell, I am a novice user so I am very much appreciate your > help. > > > -- > Paula Sims > paulasims@my-deja.com > > > Sent via Deja.com > http://www.deja.com/


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