<?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: Help regarding removing records from a dataset by matching in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Help-regarding-removing-records-from-a-dataset-by-matching/m-p/25781#M5860</link>
    <description>It can be done in one step.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
create table new as select * from old o where not exists( select * from mark m &lt;BR /&gt;
where m.var1 = o.var1 and m.var2 = o.var2);&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
or in place as &lt;BR /&gt;
proc sql;&lt;BR /&gt;
delete from old o where exists( select * from mark m &lt;BR /&gt;
where m.var1 = o.var1 and m.var2 = o.var2);&lt;BR /&gt;
quit;</description>
    <pubDate>Fri, 04 Dec 2009 13:04:39 GMT</pubDate>
    <dc:creator>Flip</dc:creator>
    <dc:date>2009-12-04T13:04:39Z</dc:date>
    <item>
      <title>Help regarding removing records from a dataset by matching</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-regarding-removing-records-from-a-dataset-by-matching/m-p/25779#M5858</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
My requirement is to match 2 files(of different record counts) using few key fields and if they match exactly then i need to remove those records from the 1st file. i.e. i need to write only the unmatched records from File-1 to output.&lt;BR /&gt;
&lt;BR /&gt;
I tried using the MERGE operation which works fine, but the prob is the SORT Order of my original file gets impacted and i am not able to find the original SORT Order to resort the file to its original sort order as LRECL is very large(LRECL=1250). Morever the number of records in the file-1 is also very large. So, when the merged contents are written to a dataset it gets abended due to space issue.&lt;BR /&gt;
&lt;BR /&gt;
i also tried using SELECT statement from PROC SQL.  But still i am facing the same space issue when i write the unmatched contents to a table to be written to the output file.&lt;BR /&gt;
&lt;BR /&gt;
I tried another option using INDEX function to match the key fields. Here also i encounter a problem. The number of records that can be matched between these 2 files is taken as file-2(which has least count). And so the unmatched records from File-1 that are written to output is exactly till the same count as in File-2. Is there any way to use the INDEX option between 2 files which do not have same number of record counts?&lt;BR /&gt;
&lt;BR /&gt;
Could you please help me out with any other options for matching these 2 files, which in turn would not require writing the entire contents of File-1 to a dataset (so that i can avoid the space issue)?&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
San</description>
      <pubDate>Fri, 04 Dec 2009 10:46:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-regarding-removing-records-from-a-dataset-by-matching/m-p/25779#M5858</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-12-04T10:46:14Z</dc:date>
    </item>
    <item>
      <title>Re: Help regarding removing records from a dataset by matching</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-regarding-removing-records-from-a-dataset-by-matching/m-p/25780#M5859</link>
      <description>proc sql;&lt;BR /&gt;
 create view match as select a.*,b.unique_b_var as check from &lt;BR /&gt;
   (select * from table1) as a&lt;BR /&gt;
     left join&lt;BR /&gt;
  (select * from table2) as b&lt;BR /&gt;
    on a.var1 = b.var1&lt;BR /&gt;
    and a.var2 = b.var2&lt;BR /&gt;
    and a.var(n) = b.var(n)&lt;BR /&gt;
 ;&lt;BR /&gt;
&lt;BR /&gt;
 create new_table as &lt;BR /&gt;
   select * &lt;BR /&gt;
  from match&lt;BR /&gt;
  where check eq .&lt;BR /&gt;
  ;&lt;BR /&gt;
quit;</description>
      <pubDate>Fri, 04 Dec 2009 11:29:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-regarding-removing-records-from-a-dataset-by-matching/m-p/25780#M5859</guid>
      <dc:creator>FredrikE</dc:creator>
      <dc:date>2009-12-04T11:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: Help regarding removing records from a dataset by matching</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-regarding-removing-records-from-a-dataset-by-matching/m-p/25781#M5860</link>
      <description>It can be done in one step.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
create table new as select * from old o where not exists( select * from mark m &lt;BR /&gt;
where m.var1 = o.var1 and m.var2 = o.var2);&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
or in place as &lt;BR /&gt;
proc sql;&lt;BR /&gt;
delete from old o where exists( select * from mark m &lt;BR /&gt;
where m.var1 = o.var1 and m.var2 = o.var2);&lt;BR /&gt;
quit;</description>
      <pubDate>Fri, 04 Dec 2009 13:04:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-regarding-removing-records-from-a-dataset-by-matching/m-p/25781#M5860</guid>
      <dc:creator>Flip</dc:creator>
      <dc:date>2009-12-04T13:04:39Z</dc:date>
    </item>
    <item>
      <title>Re: Help regarding removing records from a dataset by matching</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-regarding-removing-records-from-a-dataset-by-matching/m-p/25782#M5861</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
Thanks for ur inputs. But when i write the contents to a table using the PROC SQL Statements given in ur replies, i still get the space issue like below.&lt;BR /&gt;
&lt;BR /&gt;
"Write to WORK.'@T000000'n.UTILITY failed. File is full and may be damaged"..&lt;BR /&gt;
&lt;BR /&gt;
Is there any way to resolve this?&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
San</description>
      <pubDate>Fri, 04 Dec 2009 14:42:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-regarding-removing-records-from-a-dataset-by-matching/m-p/25782#M5861</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-12-04T14:42:34Z</dc:date>
    </item>
  </channel>
</rss>

