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
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 ;
SQL solution which I think you already have a solution there.
And Proc Compare:
base = dataset1
compare = dataset2 ;
var A ;
with B ;
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?