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>
Organization: http://groups.google.com
Subject: Re: Comparing 2 columns from 2 different datasets
In-Reply-To: <20050921214651.48283.qmail@web53805.mail.yahoo.com>
Content-Type: text/plain; charset="iso-8859-1"
Patrick,
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