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 (May 2000, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 4 May 2000 13:41:41 -0400
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: Proc Compare

Sharavi:

Are you trying to do a conditional merge, in such that, you will replace the values from XXXX with the values from YYYY only if a certain conditional logic is met with regards to 'concordance' ?

e.g. * XXXX and YYYY have the same variables; data new; merge XXXX YYYY(rename=(long list of renames for 80 variables); if (complicated conditional logic comparing variable values from XXXX with renamed variable values from YYYY) then do; <assign XXXX variables values of corresponding renamed YYYY variables> end; run;

I suggest you create a table or algorithm to create a table that contains the original variables names and the 'new' variable names for use during the compare/merge e.g. table:map original rename ---------- ------------ X1 _X1 ... X10 _X10 foo bar hula hoop Y1 _Y1 ... Y7 _Y7

Then use sql to create macro variables to do the nitty gritty renaming and reassigment

proc sql noprint; select trim(original)||'='||rename, trim(original)||'='||trim(rename)||';' into :rename separated by ' ', :reassign separated by ' ' from map;

then in the data step in the merge use YYYY(rename=(&rename)) and in the conditional assigment use &reassign;

Richard DeVenezia

"Sharavi Gandham" <SHARAVI@WORLDNET.ATT.NET> wrote in message news:200005032206.SAA19940@listserv.cc.uga.edu... > Hello All > > I have two datasets in this way > > XXXX yyyy > a 1 a 2 > b 1 b 2 > c 1 etc;. c 2 etc;. > > As you can see both the datasets have the smae variable names. I need to > compare both the variables by keeping both values to see the > cocordance/discordance between them.I know that i can merge them and compare > them.The problem is, i have 80 variables and i have to rename all of them > for one of the dataset and then do a merge to compare. > I can do that,but as you can see it is such a laborious process, I need to > know if there is any easier way to do that. > > Thanks all in advance, > > Also i need to thank all the SAS listserv group people who have replied to > me earlier too, i am glad to be a part of this group,Thanks again.


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