<?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: Finding a unmatching text in two datasets? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Finding-a-unmatching-text-in-two-datasets/m-p/932871#M366943</link>
    <description>&lt;P&gt;See if this helps:&lt;/P&gt;
&lt;P&gt;Except is designed to get unmatched from one set in another.&lt;/P&gt;
&lt;PRE&gt;proc sql; 
   create table Code_unMatch as
	   select DISTINCT code      
	   from Master_Code
      except 
	   select distinct obr_code as code
	          from code_check
      ;
quit;&lt;/PRE&gt;
&lt;P&gt;If you do a LEFT(or Right) join without a WHERE clause to reduce the results you always get all the records from the Left(or right) source.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The join approach would look like:&lt;/P&gt;
&lt;PRE&gt;proc sql; 
   create table Code_unMatch as
	   select DISTINCT a.code      
	   from Master_Code as a
   left join code_check as b    
	   on a.code=b.OBR_Code
      where not missing(b.obr_code)
	   order by a.code
   ;
quit;&lt;/PRE&gt;</description>
    <pubDate>Tue, 18 Jun 2024 16:05:40 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2024-06-18T16:05:40Z</dc:date>
    <item>
      <title>Finding a unmatching text in two datasets?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-a-unmatching-text-in-two-datasets/m-p/932867#M366942</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have two datasets, A and B. A contains 56 codes, and B has 53 codes. Dataset B is coming from A. I would like to find the 3 unmatching codes that B doesn't have. My code is listed below. But the result I got was still 56 obs, not the 3 unmatching codes. Please help me find where I went wrong.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql; 
   create table Code_unMatch as
	   select DISTINCT a.code      
	   from Master_Code as a
   left join code_check as b    
	   on a.code=b.OBR_Code
	   order by a.code;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Jun 2024 15:58:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-a-unmatching-text-in-two-datasets/m-p/932867#M366942</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2024-06-18T15:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: Finding a unmatching text in two datasets?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-a-unmatching-text-in-two-datasets/m-p/932871#M366943</link>
      <description>&lt;P&gt;See if this helps:&lt;/P&gt;
&lt;P&gt;Except is designed to get unmatched from one set in another.&lt;/P&gt;
&lt;PRE&gt;proc sql; 
   create table Code_unMatch as
	   select DISTINCT code      
	   from Master_Code
      except 
	   select distinct obr_code as code
	          from code_check
      ;
quit;&lt;/PRE&gt;
&lt;P&gt;If you do a LEFT(or Right) join without a WHERE clause to reduce the results you always get all the records from the Left(or right) source.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The join approach would look like:&lt;/P&gt;
&lt;PRE&gt;proc sql; 
   create table Code_unMatch as
	   select DISTINCT a.code      
	   from Master_Code as a
   left join code_check as b    
	   on a.code=b.OBR_Code
      where not missing(b.obr_code)
	   order by a.code
   ;
quit;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Jun 2024 16:05:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-a-unmatching-text-in-two-datasets/m-p/932871#M366943</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-06-18T16:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: Finding a unmatching text in two datasets?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-a-unmatching-text-in-two-datasets/m-p/932872#M366944</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql; 
   create table Code_unMatch as
	   select DISTINCT a.code,b.OBR_Code      
	   from Master_Code as a
   full join code_check as b    
	   on a.code=b.OBR_Code
	   order by a.code;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You should find the unmatching text this way.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 16:07:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-a-unmatching-text-in-two-datasets/m-p/932872#M366944</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-06-18T16:07:50Z</dc:date>
    </item>
  </channel>
</rss>

