<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How do I check if multiple IDs are present in other data sets in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-check-if-multiple-IDs-are-present-in-other-data-sets/m-p/738948#M230567</link>
    <description>&lt;P&gt;Thank you for your help,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've adapted your code a bit to get it to run on EG:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
	merge have1 (in=t1) have2 (in=t2);
	if t1 and t2 then
		ID_MATCH = "YES";
	else if t1 then
		ID_MATCH = "T1";
	else ID_MATCH = "T2";
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Unfortunately, the output I got when running your code looked like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;ID_Match&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1D&lt;/TD&gt;&lt;TD&gt;YES&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3F&lt;/TD&gt;&lt;TD&gt;YES&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5H&lt;/TD&gt;&lt;TD&gt;YES&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;8J&lt;/TD&gt;&lt;TD&gt;YES&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9K&lt;/TD&gt;&lt;TD&gt;YES&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID_Match should only = YES if have1 ID is also present in have2 ID. The output I'm hoping to achieve looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;ID_Match&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1D&lt;/TD&gt;&lt;TD&gt;YES&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2G&lt;/TD&gt;&lt;TD&gt;NO&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3F&lt;/TD&gt;&lt;TD&gt;YES&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4C&lt;/TD&gt;&lt;TD&gt;NO&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5H&lt;/TD&gt;&lt;TD&gt;YES&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 04 May 2021 15:22:55 GMT</pubDate>
    <dc:creator>avz</dc:creator>
    <dc:date>2021-05-04T15:22:55Z</dc:date>
    <item>
      <title>How do I check if multiple IDs are present in other data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-check-if-multiple-IDs-are-present-in-other-data-sets/m-p/738417#M230349</link>
      <description>&lt;P&gt;I have multiple data sets containing specific information about individuals. Ideally, I would have been able to merge the data sets. Unfortunately, I have too many duplicates, the IDs differ in each data set, and there are typos and spelling errors in the IDs that do overlap. So, I'm planning to check all the potential ID combinations to see if they exist in the different datasets. If they do, then I want a yes/no value in my "master" data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is essentially what I'm hoping to achieve:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data have1;
	input (ID ) ($);
	datalines;
	1D                      
	2G                      
	3F                       
	4C                       
	5H                       
;
data have2;
	input (ID ) ($);
	datalines;
	1D                      
	3F                      
	5H                       
	8J                       
	9K                       
;
data master;
	input (ID ID_Match) ($);
	datalines;
	1D    YES                  
	2G    NO                  
	3F    YES                   
	4C    NO                   
	5H    YES                   
;&lt;/PRE&gt;&lt;P&gt;I'll greatly appreciate some help!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 02 May 2021 17:46:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-check-if-multiple-IDs-are-present-in-other-data-sets/m-p/738417#M230349</guid>
      <dc:creator>avz</dc:creator>
      <dc:date>2021-05-02T17:46:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do I check if multiple IDs are present in other data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-check-if-multiple-IDs-are-present-in-other-data-sets/m-p/738421#M230350</link>
      <description>&lt;P&gt;PROC COMPARE will do what you want, or a merge will get you started as well.&lt;BR /&gt;&lt;BR /&gt;EDIT: Modified per comments. This will give you exactly what you requested, a more common request, is to identify which data set the record came from, which was closer to my original answer.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
merge have1 (in=t1) have2 (in=t2);
BY ID;

if t1 and t2 then ID_MATCH = "YES";
else ID_MATCH = "NO";

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 May 2021 16:39:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-check-if-multiple-IDs-are-present-in-other-data-sets/m-p/738421#M230350</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-05-04T16:39:34Z</dc:date>
    </item>
    <item>
      <title>Re: How do I check if multiple IDs are present in other data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-check-if-multiple-IDs-are-present-in-other-data-sets/m-p/738948#M230567</link>
      <description>&lt;P&gt;Thank you for your help,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've adapted your code a bit to get it to run on EG:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
	merge have1 (in=t1) have2 (in=t2);
	if t1 and t2 then
		ID_MATCH = "YES";
	else if t1 then
		ID_MATCH = "T1";
	else ID_MATCH = "T2";
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Unfortunately, the output I got when running your code looked like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;ID_Match&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1D&lt;/TD&gt;&lt;TD&gt;YES&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3F&lt;/TD&gt;&lt;TD&gt;YES&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5H&lt;/TD&gt;&lt;TD&gt;YES&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;8J&lt;/TD&gt;&lt;TD&gt;YES&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9K&lt;/TD&gt;&lt;TD&gt;YES&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID_Match should only = YES if have1 ID is also present in have2 ID. The output I'm hoping to achieve looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;ID_Match&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1D&lt;/TD&gt;&lt;TD&gt;YES&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2G&lt;/TD&gt;&lt;TD&gt;NO&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3F&lt;/TD&gt;&lt;TD&gt;YES&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4C&lt;/TD&gt;&lt;TD&gt;NO&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5H&lt;/TD&gt;&lt;TD&gt;YES&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 May 2021 15:22:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-check-if-multiple-IDs-are-present-in-other-data-sets/m-p/738948#M230567</guid>
      <dc:creator>avz</dc:creator>
      <dc:date>2021-05-04T15:22:55Z</dc:date>
    </item>
    <item>
      <title>Re: How do I check if multiple IDs are present in other data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-check-if-multiple-IDs-are-present-in-other-data-sets/m-p/738953#M230572</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;, I also had a look at the output of&amp;nbsp;PROC COMPARE. Unfortunately, it isn't obvious to me how I can use the output to join my datasets or create a dataset with columns that indicates if a key ID is present in both sets.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 May 2021 15:27:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-check-if-multiple-IDs-are-present-in-other-data-sets/m-p/738953#M230572</guid>
      <dc:creator>avz</dc:creator>
      <dc:date>2021-05-04T15:27:34Z</dc:date>
    </item>
    <item>
      <title>Re: How do I check if multiple IDs are present in other data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-check-if-multiple-IDs-are-present-in-other-data-sets/m-p/738982#M230589</link>
      <description>Forgot the BY statement. Add BY ID.</description>
      <pubDate>Tue, 04 May 2021 16:35:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-check-if-multiple-IDs-are-present-in-other-data-sets/m-p/738982#M230589</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-05-04T16:35:39Z</dc:date>
    </item>
    <item>
      <title>Re: How do I check if multiple IDs are present in other data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-check-if-multiple-IDs-are-present-in-other-data-sets/m-p/739055#M230619</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;, your output is better than what I expected. Thank you!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
	merge have1 (in=t1) have2 (in=t2);
	if t1 and t2 then
		ID_MATCH = "YES";
	else if t1 then
		ID_MATCH = "T1";
	else ID_MATCH = "T2";
BY ID;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 May 2021 20:18:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-check-if-multiple-IDs-are-present-in-other-data-sets/m-p/739055#M230619</guid>
      <dc:creator>avz</dc:creator>
      <dc:date>2021-05-04T20:18:04Z</dc:date>
    </item>
  </channel>
</rss>

