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 (September 2005, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 22 Sep 2005 07:22:25 -0700
Reply-To:     Toby <tobydunn@HOTMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Toby <tobydunn@HOTMAIL.COM>
Subject:      Re: Comparing 2 columns from 2 different datasets
Comments: To:
In-Reply-To:  <>
Content-Type: text/plain; charset="iso-8859-1"


Three choices are to use a Data step:

Data Match NoMatch ; set dataset1 (keep = A) ; set dataset2 (keep = B) ;

if ( A = B ) then output Match ; else output NoMatch ; run ;

SQL solution which I think you already have a solution there.

And Proc Compare:

proc compare base = dataset1 compare = dataset2 ; var A ; with B ; run ;

Toby Dunn

Hi there, How can I write a code to compare 2 columns from 2 different datasets? (Assuming the rows are corresponding) the datasets have different numbers of columns, but the 2 columns to be compared are formatted the same (same number of rows and format). For example, column A from dataset 1 and column B from dataset2. I would like to know: how many instances in A are the same with B, and how many different? Thanks Patrick Tran

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