Date: Tue, 25 Mar 2008 12:23:37 -0700
Reply-To: Haris <Karovaldas@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Haris <Karovaldas@GMAIL.COM>
Organization: http://groups.google.com
Subject: Re: how to add the observations in dataset2 to the variables in
dataset1?
Content-Type: text/plain; charset=ISO-8859-1
Sounds like all you want to do is rename the variables in your
dataset2. You should read the variable names in dataset1 into a macro
and then do the renaming in the DATA step. I prefer PROC SQL. Here's
an approximate untested syntax that should give you the results you
want.
proc sql ;
select Name
into :Macro1 separated by " "
from dictionary.columns
where libname="LIBRARY" memname="DATASET1" ;
select Name
into :Macro2 separated by " "
from dictionary.columns
where libname="LIBRARY" memname="DATASET2" ;
quit ;
data dataset2 ;
set dataset2 (rename &Macro2 = &Macro1) ;
run ;