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 (June 2000, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 29 Jun 2000 00:21:40 GMT
Reply-To:     sashole@mediaone.net
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Paul Dorfman <paul_dorfman@HOTMAIL.COM>
Subject:      Re: new variables in new dataset
Comments: To: thesis8@hotmail.com
Content-Type: text/plain; format=flowed

Toni,

You can compose the complete RENAME list beforehand and then use it in the RENAME statement, like in the code below. Also note that you cannot have a valid SAS name prefixed by 97.

62 data abcd; 63 array x id a b c d e f g h (1 2 3 4 5 6 7 8 9); 64 run; 65 66 proc sql; 67 select trim(name)||'='||trim(name)||'97' into: rnmlist 68 separated by ' ' 69 from sashelp.vcolumn 70 where libname = upcase('work') 71 and memtype = upcase('data') 72 and memname = upcase('abcd') 73 and upcase(name) not = upcase('id'); 74 quit; 75 76 data _null_; 77 set abcd (rename=(&rnmlist)); 78 put _all_; 79 run; id=1 a97=2 b97=3 c97=4 d97=5 e97=6 f97=7 g97=8 h97=9 _ERROR_=0 _N_=1

Kind regards, =================== Paul M. Dorfman Jacksonville, Fl ===================

>From: Toni Zhang <thesis8@HOTMAIL.COM> >Reply-To: Toni Zhang <thesis8@HOTMAIL.COM> >To: SAS-L@LISTSERV.UGA.EDU >Subject: new variables in new dataset >Date: Wed, 28 Jun 2000 14:20:35 PDT > >Hi folks, > >I need to merge two data files what has the same variables. One is for 1997 >and other is for 1998. Before I merge them I need to rename all the >variables (except id)in one data file, say 1997. > >I wonder if there is a shortcut that I can use in steade of using 'rename' >for every variable. For instance I want > >income=97incom >food=97food >... > >if there is syntax like array or something that I can use it at once to >have >this done? > >Please advise and thanks a lot, Toni > >________________________________________________________________________ >Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com


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