Date: Thu, 29 Jun 2000 09:35:02 -0400
Reply-To: Ian Whitlock <WHITLOI1@WESTAT.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ian Whitlock <WHITLOI1@WESTAT.COM>
Subject: Re: new variables in new dataset
Content-Type: text/plain; charset="iso-8859-1"
It is a big mistake to bury data (like dates) in variable names. This
almost always guarantees that all future programs working with the data will
be more complex than necessary. If you want to know more I will be
presenting a paper on how to make your programming tasks harder at both
SESUG and NESUG. Your suggestion ranks high on the list of possibilities.
It would be far better to interleave the data
data ... ;
set .... ( in = a ) .... ( in = b ) ;
by .... ;
if a then date = "1jan1997"d ;
else date = "1jan1998"d ;
That is another rule for easier programming - work with SAS dates. In this
case, breaking it would be probably not hurt.
Now to give you an untested answer to the rename problem.
proc sql ;
select name || "=" || trim(name) || "97" into :renm97 separated by "
where libname = "....." and memname = "....."
proc datasets lib = ..... ;
modify ..... ;
rename &renm97 ;
If you are not working in version 8, (you should be) then you will have to
worry about names that are too long. Of course, the same problem occurs in
8, but if it does, your names were too long in the first place.
Ian Whitlock <firstname.lastname@example.org>
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