|Date: ||Thu, 29 Jun 2000 08:29:59 -0400|
|Reply-To: ||"Confer, Edward" <EConfer@S-3.COM>|
|Sender: ||"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>|
|From: ||"Confer, Edward" <EConfer@S-3.COM>|
|Subject: ||Re: new variables in new dataset|
|Content-Type: ||text/plain; charset="iso-8859-1"|
options mprint symbolgen;
proc contents noprint data=data1 out=content(keep=name);
proc sql noprint;
select name into :list seperated by ' ' from content;
Here is something I developed that is relatively easy to program.
Substitute in the values for 'M' counter and 'K' counter based on the number
of variables you are renaming. IN the Contents Proc, do a keep on those you
want to rename. Important to realize I did this with very distinct 7 - 8
length vars and at 5 they were still distinct. If yours are less, you may
want to adjust. Also, a number cannot lead a variable name.
%do k=1 %to 6;
call symput("var&k",scan(x,&k,' '));
call symput("varx&k",substr(scan(x,&k,' '),1,5));
%do m=1 %to 6;
proc print ;
From: Toni Zhang [mailto:thesis8@HOTMAIL.COM]
Sent: Wednesday, June 28, 2000 5:21 PM
Subject: new variables in new dataset
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
if there is syntax like array or something that I can use it at once to have
Please advise and thanks a lot, Toni
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com