<?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: Picking rows based on a newst date in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Picking-rows-based-on-a-newst-date/m-p/472402#M14808</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Makes sense. Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the meantime, I checked RANK transformation and that does the trick - gives me ranking within parameters I need. Then I just take out rows with rank=1 for example.&lt;BR /&gt;&lt;BR /&gt;I&amp;nbsp;completelly agree&amp;nbsp;about DI Studio not being programming tool. It is possible to run all in user-written code but we are avoiding it by all means.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;</description>
    <pubDate>Fri, 22 Jun 2018 08:24:08 GMT</pubDate>
    <dc:creator>strsljen</dc:creator>
    <dc:date>2018-06-22T08:24:08Z</dc:date>
    <item>
      <title>Picking rows based on a newst date</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Picking-rows-based-on-a-newst-date/m-p/471330#M14775</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a use-case where table contains 1 or more rows for the same email address column. There is a columd "date".&lt;/P&gt;&lt;P&gt;From all rows with same email address, only the one with newest date should be taken in a result table, regardless of values of other columns (20-ish columns are in the table all together).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to handle it in DI Studio without using custom written code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jun 2018 10:32:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Picking-rows-based-on-a-newst-date/m-p/471330#M14775</guid>
      <dc:creator>strsljen</dc:creator>
      <dc:date>2018-06-19T10:32:21Z</dc:date>
    </item>
    <item>
      <title>Re: Picking rows based on a newst date</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Picking-rows-based-on-a-newst-date/m-p/471339#M14776</link>
      <description>&lt;P&gt;I found &lt;A href="https://blogs.sas.com/content/sasdummy/2012/09/18/having-clause-fun-with-sas-enterprise-guide/" target="_blank"&gt;this article&lt;/A&gt; that deals with a quite similar problem by using the Query Builder in Enterprise Guide. Maybe you can apply the method to DI Studio as well.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jun 2018 11:55:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Picking-rows-based-on-a-newst-date/m-p/471339#M14776</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-06-19T11:55:03Z</dc:date>
    </item>
    <item>
      <title>Re: Picking rows based on a newst date</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Picking-rows-based-on-a-newst-date/m-p/471597#M14783</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/166915"&gt;@strsljen&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Below two coding options should both be quite simple to implement in DIS using standard transformations.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  set sashelp.class;
  email_addr='abc.efg@blah.com';
  dt=today()+_n_;
  format dt date9.;
run;

/* option 1 */
proc sort data=have out=want1;
  by email_addr DESCENDING dt;
run;

proc sort data=want1 nodupkey;
  by email_addr;
run;

/* option 2 */
proc sql;
  create table want2 as 
    select *
    from have
    group by email_addr
    having max(dt)=dt
  ;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Jun 2018 04:36:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Picking-rows-based-on-a-newst-date/m-p/471597#M14783</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-06-20T04:36:03Z</dc:date>
    </item>
    <item>
      <title>Re: Picking rows based on a newst date</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Picking-rows-based-on-a-newst-date/m-p/472331#M14806</link>
      <description>&lt;P&gt;Personally, this is just a bit of "SQL maths", easily done with Extract nodes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;extract node to&lt;/P&gt;
&lt;P&gt;&amp;nbsp; select email, max(date) as maxdate from table group by email into work.interim&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;extract node&lt;/P&gt;
&lt;P&gt;&amp;nbsp; join that back onto the original table, joining on email = email and date = maxdate&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;All done in extract nodes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Remember, DI Studio isn't a supposed to be programming tool.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jun 2018 23:21:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Picking-rows-based-on-a-newst-date/m-p/472331#M14806</guid>
      <dc:creator>AngusLooney</dc:creator>
      <dc:date>2018-06-21T23:21:13Z</dc:date>
    </item>
    <item>
      <title>Re: Picking rows based on a newst date</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Picking-rows-based-on-a-newst-date/m-p/472402#M14808</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Makes sense. Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the meantime, I checked RANK transformation and that does the trick - gives me ranking within parameters I need. Then I just take out rows with rank=1 for example.&lt;BR /&gt;&lt;BR /&gt;I&amp;nbsp;completelly agree&amp;nbsp;about DI Studio not being programming tool. It is possible to run all in user-written code but we are avoiding it by all means.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jun 2018 08:24:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Picking-rows-based-on-a-newst-date/m-p/472402#M14808</guid>
      <dc:creator>strsljen</dc:creator>
      <dc:date>2018-06-22T08:24:08Z</dc:date>
    </item>
    <item>
      <title>Re: Picking rows based on a newst date</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Picking-rows-based-on-a-newst-date/m-p/472665#M14817</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/166915"&gt;@strsljen&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Just to clarify: The two coding option I've posted weren't meant to be implemented as user written code but as logic using standard DIS transformations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Option 1 can get implemented using two SORT transformations.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Option 2 can get implemented using a SQL Join transformation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Option 1 would should also allow to easily collect the rejected records in a second table.&lt;/P&gt;</description>
      <pubDate>Sat, 23 Jun 2018 02:59:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Picking-rows-based-on-a-newst-date/m-p/472665#M14817</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-06-23T02:59:54Z</dc:date>
    </item>
  </channel>
</rss>

