<?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: Comparing datasets and returning identical observations in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Comparing-datasets-and-returning-identical-observations/m-p/293177#M270155</link>
    <description>&lt;P&gt;Try DUPOUT= option in Proc Sort,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _stack;
set one two;
run;

proc sort data=_stack dupout=_wanted_dup nodupkey;
by _all_;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 22 Aug 2016 16:01:49 GMT</pubDate>
    <dc:creator>Haikuo</dc:creator>
    <dc:date>2016-08-22T16:01:49Z</dc:date>
    <item>
      <title>Comparing datasets and returning identical observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-datasets-and-returning-identical-observations/m-p/293173#M270154</link>
      <description>&lt;P&gt;I'm looking to compare two datasets that have just two variables each(Name &amp;amp; Num). Rather than return a listing of the differences between the datasets, what I'm after is a listing of identical obervations in the two datasets.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA ONE;                  
INPUT NAME NUM $ ;         
CARDS;                     
FRED   1234                
WILMA  4567                
BARNEY 8369                
BAMBAM 7894                
;                          
RUN;                       
                           
DATA TWO;                  
INPUT NAME NUM $ ;         
CARDS;                     
FRED   1234                
WILMA  8369                
BETTY  7894                
;                        
RUN;                                 
                                     
PROC SORT DATA=ONE NODUPKEY;         
BY NAME NUM;                         
RUN;                                 
                                     
PROC SORT DATA=TWO NODUPKEY;         
BY NAME NUM;                         
RUN;                                 
                                     
DATA FINAL;                          
PROC COMPARE BASE=ONE COMPARE=TWO;   
RUN;                                 
OUTPUT:                              &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I can't seem to find anything that will allow me to report on identical oberservations.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 22 Aug 2016 15:48:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-datasets-and-returning-identical-observations/m-p/293173#M270154</guid>
      <dc:creator>serge68</dc:creator>
      <dc:date>2016-08-22T15:48:48Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing datasets and returning identical observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-datasets-and-returning-identical-observations/m-p/293177#M270155</link>
      <description>&lt;P&gt;Try DUPOUT= option in Proc Sort,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _stack;
set one two;
run;

proc sort data=_stack dupout=_wanted_dup nodupkey;
by _all_;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 Aug 2016 16:01:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-datasets-and-returning-identical-observations/m-p/293177#M270155</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2016-08-22T16:01:49Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing datasets and returning identical observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-datasets-and-returning-identical-observations/m-p/293180#M270156</link>
      <description>&lt;P&gt;First you'll likely get better results if Name is character.&lt;/P&gt;
&lt;P&gt;Try this;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA ONE;                  
INPUT NAME $ NUM $ ;         
CARDS;                     
FRED   1234                
WILMA  4567                
BARNEY 8369                
BAMBAM 7894                
;                          
RUN;                       
                           
DATA TWO;                  
INPUT NAME $ NUM $ ;         
CARDS;                     
FRED   1234                
WILMA  8369                
BETTY  7894                
;                        
RUN;                                 
                                     
PROC SORT DATA=ONE NODUPKEY;         
BY NAME NUM;                         
RUN;                                 
                                     
PROC SORT DATA=TWO NODUPKEY;         
BY NAME NUM;                         
RUN;    

data three;
   merge one (in=inone)
         two (in=intwo);
   by name num;
   if inone and intwo;
run; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 Aug 2016 16:06:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-datasets-and-returning-identical-observations/m-p/293180#M270156</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-08-22T16:06:32Z</dc:date>
    </item>
  </channel>
</rss>

