<?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: To see the observations in a dataset but not in the other in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/To-see-the-observations-in-a-dataset-but-not-in-the-other/m-p/480926#M124318</link>
    <description>&lt;P&gt;If your data is simple, you can so something like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data data1;
a=1;output;
a=2;output;
a=3;output;
run;

data data2;
a=1;output;
a=3;output;
run;

proc sql;
   create table want as
   select * from data1
   where a not in
   (
   select distinct a from data2
   );
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Otherwise, when you compare two data sets, &lt;A href="http://documentation.sas.com/?docsetId=proc&amp;amp;docsetTarget=n0c1y14wyd3u7yn1dmfcpaejllsn.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;PROC COMPARE&lt;/A&gt; is a pretty good place to start.&lt;/P&gt;</description>
    <pubDate>Tue, 24 Jul 2018 19:48:07 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2018-07-24T19:48:07Z</dc:date>
    <item>
      <title>To see the observations in a dataset but not in the other</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-see-the-observations-in-a-dataset-but-not-in-the-other/m-p/480865#M124302</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two datasets, and i want to see what observations are in dataset2 that are not in dataset1.&lt;/P&gt;&lt;P&gt;How to do that ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;My code is this&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*proc sql ;
	create table DATASET1 as
	select distinct enrolid, code, (svcdate) as index_cpt format mmddyy10. 
	from derived._02_cpt ;
quit ;/*179*/

/*proc sql ;
	create table DATASET2 as  
	select distinct a.enrolid, min(a.index_diag, b.index_cpt) as index_date 
        format mmddyy10.
	from derived._02_tr2 as a 
	inner join derived._02_cpt2 as b 
	on a.enrolid = b.enrolid 
	where -7 le (a.index_diag-b.index_cpt) le 7
	order by a.enrolid, index_date;
quit ;/*188*/&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Jul 2018 17:36:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-see-the-observations-in-a-dataset-but-not-in-the-other/m-p/480865#M124302</guid>
      <dc:creator>manya92</dc:creator>
      <dc:date>2018-07-24T17:36:14Z</dc:date>
    </item>
    <item>
      <title>Re: To see the observations in a dataset but not in the other</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-see-the-observations-in-a-dataset-but-not-in-the-other/m-p/480901#M124309</link>
      <description>&lt;P&gt;In PROC SQL, do a FULL JOIN, the resulting data set will include all observations from both data sets, and the ones that are in one data set but not the other will be obvious.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jul 2018 19:00:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-see-the-observations-in-a-dataset-but-not-in-the-other/m-p/480901#M124309</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-07-24T19:00:57Z</dc:date>
    </item>
    <item>
      <title>Re: To see the observations in a dataset but not in the other</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-see-the-observations-in-a-dataset-but-not-in-the-other/m-p/480926#M124318</link>
      <description>&lt;P&gt;If your data is simple, you can so something like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data data1;
a=1;output;
a=2;output;
a=3;output;
run;

data data2;
a=1;output;
a=3;output;
run;

proc sql;
   create table want as
   select * from data1
   where a not in
   (
   select distinct a from data2
   );
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Otherwise, when you compare two data sets, &lt;A href="http://documentation.sas.com/?docsetId=proc&amp;amp;docsetTarget=n0c1y14wyd3u7yn1dmfcpaejllsn.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;PROC COMPARE&lt;/A&gt; is a pretty good place to start.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jul 2018 19:48:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-see-the-observations-in-a-dataset-but-not-in-the-other/m-p/480926#M124318</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-07-24T19:48:07Z</dc:date>
    </item>
  </channel>
</rss>

