<?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: Retrieve unique observations in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Retrieve-unique-observations/m-p/433606#M107515</link>
    <description>&lt;P&gt;Hi you can try the below code , but it will give you texte1 and texte2 value with some blank (missing) observations , you have to write one more step to remove the blank and keep only the unique value&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can any one suggest how to do that in a single step&amp;nbsp;&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;proc  sql;
create table want as 
select  texte1 ,  texte2 from t1  full join t2
on texte1 = texte2
where texte1 in (select texte1 from t1 left join t2 on texte1=texte2 where texte2 is null)
or texte2 in (select texte2 from t2 left join t1 on texte2=texte1 where texte1 is null);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 02 Feb 2018 17:01:10 GMT</pubDate>
    <dc:creator>soham_sas</dc:creator>
    <dc:date>2018-02-02T17:01:10Z</dc:date>
    <item>
      <title>Retrieve unique observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retrieve-unique-observations/m-p/433471#M107467</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have two tables&amp;nbsp;:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data t1&amp;nbsp;;&lt;/P&gt;&lt;P&gt;Input texte1&amp;nbsp;;&lt;/P&gt;&lt;P&gt;Cards&amp;nbsp;;&lt;/P&gt;&lt;P&gt;ERGO&lt;/P&gt;&lt;P&gt;ERGY&lt;/P&gt;&lt;P&gt;DERMU&lt;/P&gt;&lt;P&gt;FERMI&lt;/P&gt;&lt;P&gt;VERMO&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;Run&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data t2&amp;nbsp;;&lt;/P&gt;&lt;P&gt;Input texte2&amp;nbsp;;&lt;/P&gt;&lt;P&gt;Cards&amp;nbsp;;&lt;/P&gt;&lt;P&gt;ERGO&lt;/P&gt;&lt;P&gt;CRGY&lt;/P&gt;&lt;P&gt;DERMU&lt;/P&gt;&lt;P&gt;ZERMI&lt;/P&gt;&lt;P&gt;VERMO&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;Run&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to create a 3rd table with items that are only present in one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And get&amp;nbsp;:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Texte1&amp;nbsp;&amp;nbsp; Texte2&lt;/P&gt;&lt;P&gt;ERGY&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CRGY&lt;/P&gt;&lt;P&gt;FERMI&amp;nbsp; ZERMI&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you for your help&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2018 11:05:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retrieve-unique-observations/m-p/433471#M107467</guid>
      <dc:creator>WilliamB</dc:creator>
      <dc:date>2018-02-02T11:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve unique observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retrieve-unique-observations/m-p/433474#M107469</link>
      <description>&lt;P&gt;Run a proc sort nodupkey on both datasets.&amp;nbsp; As there is not link between the two its hard to say how to put them together:&lt;/P&gt;
&lt;PRE&gt;proc sort data=t1 nodupkey;
  by texte1;
run;
proc sort data=t2 nodupkey;
  by texte2;
run;
data want;
  merge t1 t2;
  by ...;
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Feb 2018 11:15:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retrieve-unique-observations/m-p/433474#M107469</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-02-02T11:15:34Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve unique observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retrieve-unique-observations/m-p/433506#M107482</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data t1 ;  
Input texte1 $; 
Cards ;  
ERGO  
ERGY  
DERMU  
FERMI  
VERMO  
;  
Run;        
Data t2 ;  
Input texte2 $ ;  
Cards ;  
ERGO  
CRGY  
DERMU  
ZERMI  
VERMO  
;  
Run;
proc sql;
create table x1 as
 select texte1 from t1
 except
 select texte2 from t2 ;

create table x2 as
 select texte2 from t2
 except
 select texte1 from t1 ;
quit;
data want;
 merge x1 x2;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Feb 2018 12:46:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retrieve-unique-observations/m-p/433506#M107482</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-02-02T12:46:19Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve unique observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retrieve-unique-observations/m-p/433606#M107515</link>
      <description>&lt;P&gt;Hi you can try the below code , but it will give you texte1 and texte2 value with some blank (missing) observations , you have to write one more step to remove the blank and keep only the unique value&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can any one suggest how to do that in a single step&amp;nbsp;&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;proc  sql;
create table want as 
select  texte1 ,  texte2 from t1  full join t2
on texte1 = texte2
where texte1 in (select texte1 from t1 left join t2 on texte1=texte2 where texte2 is null)
or texte2 in (select texte2 from t2 left join t1 on texte2=texte1 where texte1 is null);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Feb 2018 17:01:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retrieve-unique-observations/m-p/433606#M107515</guid>
      <dc:creator>soham_sas</dc:creator>
      <dc:date>2018-02-02T17:01:10Z</dc:date>
    </item>
  </channel>
</rss>

