<?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: macro list from dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/macro-list-from-dataset/m-p/672787#M202238</link>
    <description>&lt;P&gt;If I am understanding you properly, you want to use a RIGHT JOIN instead of an INNER JOIN&lt;/P&gt;</description>
    <pubDate>Tue, 28 Jul 2020 12:03:11 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2020-07-28T12:03:11Z</dc:date>
    <item>
      <title>macro list from dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-list-from-dataset/m-p/672783#M202235</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a (small) dataset with a datavariable x, of type string. I want to use its values to select data from another (big) set. Doing an inner join as follows seems to be too time-consuming.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table aa as
select
a.*
from big a
inner join small b
on a.x = b.x
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Is there a better way? For example, first put the x values from the small set into a macro list, and then subset on the big one using a where statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dimitri&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2020 11:58:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-list-from-dataset/m-p/672783#M202235</guid>
      <dc:creator>drdee</dc:creator>
      <dc:date>2020-07-28T11:58:05Z</dc:date>
    </item>
    <item>
      <title>Re: macro list from dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-list-from-dataset/m-p/672786#M202237</link>
      <description>&lt;P&gt;Use a hash object. No sorting required (the hash sorts internally), will be fastest.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data aa;
set big;
if _n_ = 1
then do;
  declare hash b (dataset:"small (keep=x)");
  b.definekey('x');
  b.definedone();
end;
if b.check() = 0;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Jul 2020 12:02:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-list-from-dataset/m-p/672786#M202237</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-07-28T12:02:02Z</dc:date>
    </item>
    <item>
      <title>Re: macro list from dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-list-from-dataset/m-p/672787#M202238</link>
      <description>&lt;P&gt;If I am understanding you properly, you want to use a RIGHT JOIN instead of an INNER JOIN&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2020 12:03:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-list-from-dataset/m-p/672787#M202238</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-07-28T12:03:11Z</dc:date>
    </item>
    <item>
      <title>Re: macro list from dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-list-from-dataset/m-p/672788#M202239</link>
      <description>&lt;P&gt;Instead of the inner join, you can use a WHERE clause in SQL:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table aa as
  select *
  from big
  where x in (select distinct x from small)
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Jul 2020 12:04:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-list-from-dataset/m-p/672788#M202239</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-07-28T12:04:18Z</dc:date>
    </item>
    <item>
      <title>Re: macro list from dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-list-from-dataset/m-p/672794#M202243</link>
      <description>Hi Paige,&lt;BR /&gt;&lt;BR /&gt;Thanks for your reply! Yes, it may also be useful to see when some x values are not found in the big set.&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Dimitri</description>
      <pubDate>Tue, 28 Jul 2020 12:23:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-list-from-dataset/m-p/672794#M202243</guid>
      <dc:creator>drdee</dc:creator>
      <dc:date>2020-07-28T12:23:26Z</dc:date>
    </item>
    <item>
      <title>Re: macro list from dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-list-from-dataset/m-p/672795#M202244</link>
      <description>Hi Kurt,&lt;BR /&gt;&lt;BR /&gt;Many thanks for your quick replies! Both work perfectly. I accepted the second as it is easier to understand (for me) what happens.&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Dimitri</description>
      <pubDate>Tue, 28 Jul 2020 12:24:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-list-from-dataset/m-p/672795#M202244</guid>
      <dc:creator>drdee</dc:creator>
      <dc:date>2020-07-28T12:24:40Z</dc:date>
    </item>
  </channel>
</rss>

