<?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: getting only the non intersection records in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/getting-only-the-non-intersection-records/m-p/41431#M10707</link>
    <description>Sounds like you want to replace your original files (at some point) and eliminate the redundant observations (based on CID values).&lt;BR /&gt;
&lt;BR /&gt;
Explore using PROC SORT NODUPKEY with DUPOUT and identify each incoming observation by file and observation_number.  With the DUPOUT file, then you have a source to use to DELETE observations back in the original file with a MERGE/BY process.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
    <pubDate>Fri, 15 Jan 2010 17:11:26 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2010-01-15T17:11:26Z</dc:date>
    <item>
      <title>getting only the non intersection records</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/getting-only-the-non-intersection-records/m-p/41429#M10705</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I have few data sets like DS1, DS2 and DS3 with "cid" as the only variable.&lt;BR /&gt;
&lt;BR /&gt;
DS1                  DS2             DS3&lt;BR /&gt;
&lt;BR /&gt;
CID                    CID              CID &lt;BR /&gt;
100                    100              101&lt;BR /&gt;
101                    102              106&lt;BR /&gt;
102                    105              107&lt;BR /&gt;
103                                       108&lt;BR /&gt;
104&lt;BR /&gt;
&lt;BR /&gt;
In these Data sets there are some records which is present in more than one data set.  I want the remove the intersecting records for the other data sets.  My way is to use merge statement for each combination to remove the intersections, but it is so ugly and lot of data steps.  Is there a smooth ways of dealing with such issues?&lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance.&lt;BR /&gt;
&lt;BR /&gt;
Sandy.</description>
      <pubDate>Fri, 15 Jan 2010 16:45:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/getting-only-the-non-intersection-records/m-p/41429#M10705</guid>
      <dc:creator>Sandhya</dc:creator>
      <dc:date>2010-01-15T16:45:48Z</dc:date>
    </item>
    <item>
      <title>Re: getting only the non intersection records</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/getting-only-the-non-intersection-records/m-p/41430#M10706</link>
      <description>If I understand right, you can try something like this:&lt;BR /&gt;
proc sql;&lt;BR /&gt;
delete from ds2 &lt;BR /&gt;
where cid in (select distinct cid from ds1);&lt;BR /&gt;
quit;</description>
      <pubDate>Fri, 15 Jan 2010 17:03:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/getting-only-the-non-intersection-records/m-p/41430#M10706</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-01-15T17:03:31Z</dc:date>
    </item>
    <item>
      <title>Re: getting only the non intersection records</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/getting-only-the-non-intersection-records/m-p/41431#M10707</link>
      <description>Sounds like you want to replace your original files (at some point) and eliminate the redundant observations (based on CID values).&lt;BR /&gt;
&lt;BR /&gt;
Explore using PROC SORT NODUPKEY with DUPOUT and identify each incoming observation by file and observation_number.  With the DUPOUT file, then you have a source to use to DELETE observations back in the original file with a MERGE/BY process.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Fri, 15 Jan 2010 17:11:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/getting-only-the-non-intersection-records/m-p/41431#M10707</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-01-15T17:11:26Z</dc:date>
    </item>
    <item>
      <title>Re: getting only the non intersection records</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/getting-only-the-non-intersection-records/m-p/41432#M10708</link>
      <description>If I got this right, a single merge with every datasets will suffice.&lt;BR /&gt;
&lt;BR /&gt;
You just need to work a subsetting if that will suite your needs.&lt;BR /&gt;
&lt;BR /&gt;
For example the following:&lt;BR /&gt;
[pre]&lt;BR /&gt;
data OUT;&lt;BR /&gt;
merge DS1 (in=D1) DS2 (in=D2) DS3 (in=D3);&lt;BR /&gt;
by CID;&lt;BR /&gt;
if (D1 and D2 and D3) then delete;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Or..&lt;BR /&gt;
[pre]&lt;BR /&gt;
data OUT;&lt;BR /&gt;
merge DS1 (in=D1) DS2 (in=D2) DS3 (in=D3);&lt;BR /&gt;
by CID;&lt;BR /&gt;
if not (D1 and D2 and D3); &lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
both will do the same, and will exclude the observations that full match on the 3 tables (3 way intersection).&lt;BR /&gt;
&lt;BR /&gt;
Bare in mind that one requisite for the merge to work, is that only one of the tables may hold duplicate key values.&lt;BR /&gt;
&lt;BR /&gt;
Check this info:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a000761932.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a000761932.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Cheers from Portugal.&lt;BR /&gt;
&lt;BR /&gt;
Daniel Santos @ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;</description>
      <pubDate>Fri, 15 Jan 2010 17:21:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/getting-only-the-non-intersection-records/m-p/41432#M10708</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2010-01-15T17:21:35Z</dc:date>
    </item>
    <item>
      <title>Re: getting only the non intersection records</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/getting-only-the-non-intersection-records/m-p/41433#M10709</link>
      <description>Thank you for all your suggestions.  It was very helpful.  Also, got to know about dupout.  Cool feature.&lt;BR /&gt;
&lt;BR /&gt;
Sandy.</description>
      <pubDate>Fri, 15 Jan 2010 19:51:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/getting-only-the-non-intersection-records/m-p/41433#M10709</guid>
      <dc:creator>Sandhya</dc:creator>
      <dc:date>2010-01-15T19:51:20Z</dc:date>
    </item>
  </channel>
</rss>

