<?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: &amp;quot;Where&amp;quot; type search in other table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/quot-Where-quot-type-search-in-other-table/m-p/593618#M170390</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/291423"&gt;@polpel&lt;/a&gt;:&lt;/P&gt;
&lt;P&gt;There're no fewer than 20 different methods of doing this in SAS.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;has shown you one, perhaps the simplest.&lt;/LI&gt;
&lt;LI&gt;If you have a "huge" base table and a rather short reference list, an inner join could be better since, unlike the&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;'s subquery, it can hash the list and look it up for every row in the huge table without sorting the latter.&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;Another option is to stick the keys from the reference table in to a hash table in memory and look it up for every record from the base table in the DATA step.&lt;/LI&gt;
&lt;LI&gt;If your reference list is static and you're going to search it often, perhaps the best option is to create an in/format using the reference file's keys as the in/format input with something like 1 or "1" as the in/format response. Then the in/format can be used in the WHERE clause, be it the DATA step or SQL.&amp;nbsp;&amp;nbsp;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Show samples of your two files, and you can be assured that plenty of folks here will show you concrete ways of how any of the above (and more) can be done.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind regards&lt;/P&gt;
&lt;P&gt;Paul D.&lt;/P&gt;</description>
    <pubDate>Thu, 03 Oct 2019 07:17:00 GMT</pubDate>
    <dc:creator>hashman</dc:creator>
    <dc:date>2019-10-03T07:17:00Z</dc:date>
    <item>
      <title>"Where" type search in other table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-Where-quot-type-search-in-other-table/m-p/593407#M170289</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need help with something.&lt;/P&gt;&lt;P&gt;Basically, I've got a huge table containing IDs, and what I would like is to filter this table so that I only have the IDs that are listed in another table. I want to do this because I don't want a giant "where" statement in the middle of my code.&lt;/P&gt;&lt;P&gt;But what I'm looking to do is like :&lt;/P&gt;&lt;P&gt;set have where (ids are listed with id reference table).&lt;/P&gt;&lt;P&gt;Is there any way to do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!!&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2019 15:03:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-Where-quot-type-search-in-other-table/m-p/593407#M170289</guid>
      <dc:creator>polpel</dc:creator>
      <dc:date>2019-10-02T15:03:42Z</dc:date>
    </item>
    <item>
      <title>Re: "Where" type search in other table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-Where-quot-type-search-in-other-table/m-p/593419#M170295</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as
select *
from have
where name in (select name from sashelp.class);
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;SQL is better for this type of functionality.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otherwise a MERGE can also do this.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/291423"&gt;@polpel&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need help with something.&lt;/P&gt;
&lt;P&gt;Basically, I've got a huge table containing IDs, and what I would like is to filter this table so that I only have the IDs that are listed in another table. I want to do this because I don't want a giant "where" statement in the middle of my code.&lt;/P&gt;
&lt;P&gt;But what I'm looking to do is like :&lt;/P&gt;
&lt;P&gt;set have where (ids are listed with id reference table).&lt;/P&gt;
&lt;P&gt;Is there any way to do this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance!!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2019 15:14:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-Where-quot-type-search-in-other-table/m-p/593419#M170295</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-10-02T15:14:22Z</dc:date>
    </item>
    <item>
      <title>Re: "Where" type search in other table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-Where-quot-type-search-in-other-table/m-p/593618#M170390</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/291423"&gt;@polpel&lt;/a&gt;:&lt;/P&gt;
&lt;P&gt;There're no fewer than 20 different methods of doing this in SAS.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;has shown you one, perhaps the simplest.&lt;/LI&gt;
&lt;LI&gt;If you have a "huge" base table and a rather short reference list, an inner join could be better since, unlike the&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;'s subquery, it can hash the list and look it up for every row in the huge table without sorting the latter.&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;Another option is to stick the keys from the reference table in to a hash table in memory and look it up for every record from the base table in the DATA step.&lt;/LI&gt;
&lt;LI&gt;If your reference list is static and you're going to search it often, perhaps the best option is to create an in/format using the reference file's keys as the in/format input with something like 1 or "1" as the in/format response. Then the in/format can be used in the WHERE clause, be it the DATA step or SQL.&amp;nbsp;&amp;nbsp;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Show samples of your two files, and you can be assured that plenty of folks here will show you concrete ways of how any of the above (and more) can be done.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind regards&lt;/P&gt;
&lt;P&gt;Paul D.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Oct 2019 07:17:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-Where-quot-type-search-in-other-table/m-p/593618#M170390</guid>
      <dc:creator>hashman</dc:creator>
      <dc:date>2019-10-03T07:17:00Z</dc:date>
    </item>
  </channel>
</rss>

