<?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: DI Studio - Lookup Greater and Less Than in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Lookup-Greater-and-Less-Than/m-p/174080#M3438</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Untested - but with a SQL you would need something as below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could also use a Proc Sort and then a data step with "if.first cd" - but the data step would need to be user written code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; create table want as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select o.*&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; have o,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (select cd, max(date) as max_date from have group by cd having max(date) as date) i&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where o.cd=i.cd and o.date=i.max_date&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 15 Dec 2013 22:33:17 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2013-12-15T22:33:17Z</dc:date>
    <item>
      <title>DI Studio - Lookup Greater and Less Than</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Lookup-Greater-and-Less-Than/m-p/174075#M3433</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can I use the operators &amp;gt; and &amp;lt; in the Lookup transformation in DI Studio?&lt;/P&gt;&lt;P&gt;I need to find if a date is within a date range for a given key and to return only one record for each search.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Dec 2013 01:30:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Lookup-Greater-and-Less-Than/m-p/174075#M3433</guid>
      <dc:creator>DavidCaliman</dc:creator>
      <dc:date>2013-12-15T01:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio - Lookup Greater and Less Than</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Lookup-Greater-and-Less-Than/m-p/174076#M3434</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To answer such questions it's often worth to look into the code DI Studio generates. The DI Lookup transformation generates a data step with a hash lookup - and a hash lookup works via exact key match.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The SQL Join transformation would allow for date ranges.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Dec 2013 04:16:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Lookup-Greater-and-Less-Than/m-p/174076#M3434</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2013-12-15T04:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio - Lookup Greater and Less Than</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Lookup-Greater-and-Less-Than/m-p/174077#M3435</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tks Patrick!&lt;/P&gt;&lt;P&gt;I will then use the join.&lt;/P&gt;&lt;P&gt;The lookup always returns one record for each match found?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Dec 2013 12:31:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Lookup-Greater-and-Less-Than/m-p/174077#M3435</guid>
      <dc:creator>DavidCaliman</dc:creator>
      <dc:date>2013-12-15T12:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio - Lookup Greater and Less Than</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Lookup-Greater-and-Less-Than/m-p/174078#M3436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, the first one I believe if there are a multiple matches.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Dec 2013 17:58:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Lookup-Greater-and-Less-Than/m-p/174078#M3436</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2013-12-15T17:58:17Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio - Lookup Greater and Less Than</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Lookup-Greater-and-Less-Than/m-p/174079#M3437</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If I want to return only one record for each code below, which component should I use?&lt;/P&gt;&lt;P&gt;- Group by CD and rank by MAX(DATA)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Input:&lt;/P&gt;&lt;P&gt;cd dsc date &lt;/P&gt;&lt;P&gt;1&amp;nbsp; aaa&amp;nbsp; 2013-01-31 &lt;/P&gt;&lt;P&gt;1&amp;nbsp; bbb&amp;nbsp; 2013-01-02 &lt;/P&gt;&lt;P&gt;1 cccc&amp;nbsp; 2013-01-21 &lt;/P&gt;&lt;P&gt;2 xxxx&amp;nbsp; 2013-01-12 &lt;/P&gt;&lt;P&gt;2&amp;nbsp; yyyy&amp;nbsp; 2013-01-15&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;P&gt;cd dsc date &lt;/P&gt;&lt;P&gt;1&amp;nbsp; aaa&amp;nbsp; 2013-01-31 &lt;/P&gt;&lt;P&gt;2&amp;nbsp; yyyy&amp;nbsp; 2013-01-15&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Dec 2013 22:00:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Lookup-Greater-and-Less-Than/m-p/174079#M3437</guid>
      <dc:creator>DavidCaliman</dc:creator>
      <dc:date>2013-12-15T22:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio - Lookup Greater and Less Than</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Lookup-Greater-and-Less-Than/m-p/174080#M3438</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Untested - but with a SQL you would need something as below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could also use a Proc Sort and then a data step with "if.first cd" - but the data step would need to be user written code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; create table want as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select o.*&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; have o,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (select cd, max(date) as max_date from have group by cd having max(date) as date) i&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where o.cd=i.cd and o.date=i.max_date&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Dec 2013 22:33:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Lookup-Greater-and-Less-Than/m-p/174080#M3438</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2013-12-15T22:33:17Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio - Lookup Greater and Less Than</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Lookup-Greater-and-Less-Than/m-p/174081#M3439</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The hash code generated doesn't use "multidata" so for multiple keys only the first one will be loaded into the hash - and that's then what you get via a look-up.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Dec 2013 22:35:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Lookup-Greater-and-Less-Than/m-p/174081#M3439</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2013-12-15T22:35:32Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio - Lookup Greater and Less Than</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Lookup-Greater-and-Less-Than/m-p/174082#M3440</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The rank transformation does not automatically calculate this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Input:&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;cd dsc date&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;1&amp;nbsp; aaa&amp;nbsp; 2013-01-31&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;1&amp;nbsp; bbb&amp;nbsp; 2013-01-02&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;1 cccc&amp;nbsp; 2013-01-21&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;2 xxxx&amp;nbsp; 2013-01-12&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;2&amp;nbsp; yyyy&amp;nbsp; 2013-01-15&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Output:&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;cd dsc date&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;1&amp;nbsp; aaa&amp;nbsp; 2013-01-31&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;2&amp;nbsp; yyyy&amp;nbsp; 2013-01-15&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Dec 2013 18:36:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Lookup-Greater-and-Less-Than/m-p/174082#M3440</guid>
      <dc:creator>DavidCaliman</dc:creator>
      <dc:date>2013-12-16T18:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio - Lookup Greater and Less Than</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Lookup-Greater-and-Less-Than/m-p/174083#M3441</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be it does. Make sure you don't have ties.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and.. you should always start a new thread for a new question and mark an answered thread as answered. Else everything becomes a mix-up like here.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Dec 2013 01:44:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Lookup-Greater-and-Less-Than/m-p/174083#M3441</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2013-12-17T01:44:42Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio - Lookup Greater and Less Than</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Lookup-Greater-and-Less-Than/m-p/174084#M3442</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK. I will start a new thread. Tks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Dec 2013 10:32:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Lookup-Greater-and-Less-Than/m-p/174084#M3442</guid>
      <dc:creator>DavidCaliman</dc:creator>
      <dc:date>2013-12-17T10:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio - Lookup Greater and Less Than</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Lookup-Greater-and-Less-Than/m-p/174085#M3443</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this using the join node with just one input&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; create table want as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select o.*&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; have o,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; having date=max(date)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Dec 2013 16:40:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Lookup-Greater-and-Less-Than/m-p/174085#M3443</guid>
      <dc:creator>Barnipaz</dc:creator>
      <dc:date>2013-12-19T16:40:18Z</dc:date>
    </item>
  </channel>
</rss>

