<?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 Dedup if the difference between the transaction time is within 2 hours in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Dedup-if-the-difference-between-the-transaction-time-is-within-2/m-p/734011#M228712</link>
    <description>&lt;P&gt;In SAS, I have a transaction data and I need to dedup it in such a way that if a customer has attempted multiple transactions of the same amount with the same merchant within 2 hours then I should get the latest instance based on transaction time in my final dataset, but if the transaction time is greater than 2 hours then I should get all the records. Below is my sample data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;cust_nbr&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;txn_id&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;merchant&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;txn_amt&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;acct_num&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;txn_date&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;txn_time&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11111111111111111111&lt;/TD&gt;&lt;TD&gt;A1234&lt;/TD&gt;&lt;TD&gt;XYZ&lt;/TD&gt;&lt;TD&gt;1000&lt;/TD&gt;&lt;TD&gt;0123456789&lt;/TD&gt;&lt;TD&gt;17Jan2021&lt;/TD&gt;&lt;TD&gt;23:59:57&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11111111111111111111&lt;/TD&gt;&lt;TD&gt;B9021&lt;/TD&gt;&lt;TD&gt;XYZ&lt;/TD&gt;&lt;TD&gt;1000&lt;/TD&gt;&lt;TD&gt;0123456789&lt;/TD&gt;&lt;TD&gt;18Jan2021&lt;/TD&gt;&lt;TD&gt;0:00:03&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11111111111111111111&lt;/TD&gt;&lt;TD&gt;V7619&lt;/TD&gt;&lt;TD&gt;XYZ&lt;/TD&gt;&lt;TD&gt;2000&lt;/TD&gt;&lt;TD&gt;0123456789&lt;/TD&gt;&lt;TD&gt;18Jan2021&lt;/TD&gt;&lt;TD&gt;0:00:08&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11111111111111111111&lt;/TD&gt;&lt;TD&gt;W8911&lt;/TD&gt;&lt;TD&gt;XYZ&lt;/TD&gt;&lt;TD&gt;2000&lt;/TD&gt;&lt;TD&gt;0123456789&lt;/TD&gt;&lt;TD&gt;18Jan2021&lt;/TD&gt;&lt;TD&gt;0:00:20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;22222222222222222&lt;/TD&gt;&lt;TD&gt;J0569&lt;/TD&gt;&lt;TD&gt;ABC&lt;/TD&gt;&lt;TD&gt;3000&lt;/TD&gt;&lt;TD&gt;9876543210&lt;/TD&gt;&lt;TD&gt;17Jan2021&lt;/TD&gt;&lt;TD&gt;8:00:02&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;22222222222222222&lt;/TD&gt;&lt;TD&gt;T2801&lt;/TD&gt;&lt;TD&gt;ABC&lt;/TD&gt;&lt;TD&gt;3000&lt;/TD&gt;&lt;TD&gt;9876543210&lt;/TD&gt;&lt;TD&gt;18Jan2021&lt;/TD&gt;&lt;TD&gt;9:00:07&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And below is my desired output.&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;cust_nbr&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;txn_id&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;merchant&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;txn_amt&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;acct_num&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;txn_date&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;txn_time&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11111111111111111111&lt;/TD&gt;&lt;TD&gt;B9021&lt;/TD&gt;&lt;TD&gt;XYZ&lt;/TD&gt;&lt;TD&gt;1000&lt;/TD&gt;&lt;TD&gt;0123456789&lt;/TD&gt;&lt;TD&gt;18Jan2021&lt;/TD&gt;&lt;TD&gt;0:00:03&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11111111111111111111&lt;/TD&gt;&lt;TD&gt;W8911&lt;/TD&gt;&lt;TD&gt;XYZ&lt;/TD&gt;&lt;TD&gt;2000&lt;/TD&gt;&lt;TD&gt;0123456789&lt;/TD&gt;&lt;TD&gt;18Jan2021&lt;/TD&gt;&lt;TD&gt;0:00:20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;22222222222222222&lt;/TD&gt;&lt;TD&gt;J0569&lt;/TD&gt;&lt;TD&gt;ABC&lt;/TD&gt;&lt;TD&gt;3000&lt;/TD&gt;&lt;TD&gt;9876543210&lt;/TD&gt;&lt;TD&gt;17Jan2021&lt;/TD&gt;&lt;TD&gt;8:00:02&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;22222222222222222&lt;/TD&gt;&lt;TD&gt;T2801&lt;/TD&gt;&lt;TD&gt;ABC&lt;/TD&gt;&lt;TD&gt;3000&lt;/TD&gt;&lt;TD&gt;9876543210&lt;/TD&gt;&lt;TD&gt;18Jan2021&lt;/TD&gt;&lt;TD&gt;9:00:07&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am guessing I need to do some kind of conditional deduping based on transaction date and time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is appreciated !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19750"&gt;@MichelleHomes&lt;/a&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 15 Apr 2021 03:57:53 GMT</pubDate>
    <dc:creator>pk1206</dc:creator>
    <dc:date>2021-04-15T03:57:53Z</dc:date>
    <item>
      <title>Dedup if the difference between the transaction time is within 2 hours</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dedup-if-the-difference-between-the-transaction-time-is-within-2/m-p/734011#M228712</link>
      <description>&lt;P&gt;In SAS, I have a transaction data and I need to dedup it in such a way that if a customer has attempted multiple transactions of the same amount with the same merchant within 2 hours then I should get the latest instance based on transaction time in my final dataset, but if the transaction time is greater than 2 hours then I should get all the records. Below is my sample data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;cust_nbr&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;txn_id&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;merchant&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;txn_amt&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;acct_num&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;txn_date&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;txn_time&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11111111111111111111&lt;/TD&gt;&lt;TD&gt;A1234&lt;/TD&gt;&lt;TD&gt;XYZ&lt;/TD&gt;&lt;TD&gt;1000&lt;/TD&gt;&lt;TD&gt;0123456789&lt;/TD&gt;&lt;TD&gt;17Jan2021&lt;/TD&gt;&lt;TD&gt;23:59:57&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11111111111111111111&lt;/TD&gt;&lt;TD&gt;B9021&lt;/TD&gt;&lt;TD&gt;XYZ&lt;/TD&gt;&lt;TD&gt;1000&lt;/TD&gt;&lt;TD&gt;0123456789&lt;/TD&gt;&lt;TD&gt;18Jan2021&lt;/TD&gt;&lt;TD&gt;0:00:03&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11111111111111111111&lt;/TD&gt;&lt;TD&gt;V7619&lt;/TD&gt;&lt;TD&gt;XYZ&lt;/TD&gt;&lt;TD&gt;2000&lt;/TD&gt;&lt;TD&gt;0123456789&lt;/TD&gt;&lt;TD&gt;18Jan2021&lt;/TD&gt;&lt;TD&gt;0:00:08&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11111111111111111111&lt;/TD&gt;&lt;TD&gt;W8911&lt;/TD&gt;&lt;TD&gt;XYZ&lt;/TD&gt;&lt;TD&gt;2000&lt;/TD&gt;&lt;TD&gt;0123456789&lt;/TD&gt;&lt;TD&gt;18Jan2021&lt;/TD&gt;&lt;TD&gt;0:00:20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;22222222222222222&lt;/TD&gt;&lt;TD&gt;J0569&lt;/TD&gt;&lt;TD&gt;ABC&lt;/TD&gt;&lt;TD&gt;3000&lt;/TD&gt;&lt;TD&gt;9876543210&lt;/TD&gt;&lt;TD&gt;17Jan2021&lt;/TD&gt;&lt;TD&gt;8:00:02&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;22222222222222222&lt;/TD&gt;&lt;TD&gt;T2801&lt;/TD&gt;&lt;TD&gt;ABC&lt;/TD&gt;&lt;TD&gt;3000&lt;/TD&gt;&lt;TD&gt;9876543210&lt;/TD&gt;&lt;TD&gt;18Jan2021&lt;/TD&gt;&lt;TD&gt;9:00:07&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And below is my desired output.&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;cust_nbr&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;txn_id&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;merchant&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;txn_amt&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;acct_num&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;txn_date&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;txn_time&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11111111111111111111&lt;/TD&gt;&lt;TD&gt;B9021&lt;/TD&gt;&lt;TD&gt;XYZ&lt;/TD&gt;&lt;TD&gt;1000&lt;/TD&gt;&lt;TD&gt;0123456789&lt;/TD&gt;&lt;TD&gt;18Jan2021&lt;/TD&gt;&lt;TD&gt;0:00:03&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11111111111111111111&lt;/TD&gt;&lt;TD&gt;W8911&lt;/TD&gt;&lt;TD&gt;XYZ&lt;/TD&gt;&lt;TD&gt;2000&lt;/TD&gt;&lt;TD&gt;0123456789&lt;/TD&gt;&lt;TD&gt;18Jan2021&lt;/TD&gt;&lt;TD&gt;0:00:20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;22222222222222222&lt;/TD&gt;&lt;TD&gt;J0569&lt;/TD&gt;&lt;TD&gt;ABC&lt;/TD&gt;&lt;TD&gt;3000&lt;/TD&gt;&lt;TD&gt;9876543210&lt;/TD&gt;&lt;TD&gt;17Jan2021&lt;/TD&gt;&lt;TD&gt;8:00:02&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;22222222222222222&lt;/TD&gt;&lt;TD&gt;T2801&lt;/TD&gt;&lt;TD&gt;ABC&lt;/TD&gt;&lt;TD&gt;3000&lt;/TD&gt;&lt;TD&gt;9876543210&lt;/TD&gt;&lt;TD&gt;18Jan2021&lt;/TD&gt;&lt;TD&gt;9:00:07&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am guessing I need to do some kind of conditional deduping based on transaction date and time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is appreciated !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19750"&gt;@MichelleHomes&lt;/a&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 03:57:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dedup-if-the-difference-between-the-transaction-time-is-within-2/m-p/734011#M228712</guid>
      <dc:creator>pk1206</dc:creator>
      <dc:date>2021-04-15T03:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: Dedup if the difference between the transaction time is within 2 hours</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dedup-if-the-difference-between-the-transaction-time-is-within-2/m-p/734078#M228718</link>
      <description>&lt;P&gt;Is the variable txn_time the start and end time of the transaction instead of the transaction time?&lt;BR /&gt;Is there a key to identify a single transaction? Or do you always have a set of start and end records?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 03:12:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dedup-if-the-difference-between-the-transaction-time-is-within-2/m-p/734078#M228718</guid>
      <dc:creator>japelin</dc:creator>
      <dc:date>2021-04-15T03:12:56Z</dc:date>
    </item>
    <item>
      <title>Re: Dedup if the difference between the transaction time is within 2 hours</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dedup-if-the-difference-between-the-transaction-time-is-within-2/m-p/734089#M228721</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/226565"&gt;@japelin&lt;/a&gt;&amp;nbsp;Variable txn_time is the exact time at which the transaction took place and to identify a single transaction I have txn_id column in my dataset. I have edited my post and added txn_id in my sample data and desired output table.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 04:01:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dedup-if-the-difference-between-the-transaction-time-is-within-2/m-p/734089#M228721</guid>
      <dc:creator>pk1206</dc:creator>
      <dc:date>2021-04-15T04:01:55Z</dc:date>
    </item>
    <item>
      <title>Re: Dedup if the difference between the transaction time is within 2 hours</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dedup-if-the-difference-between-the-transaction-time-is-within-2/m-p/734095#M228723</link>
      <description>&lt;P&gt;If&amp;nbsp;de-dupable transactions are consecutive (i.e. never separated by some other transaction), then:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Editted correction to include transaction date as well as transaction time:&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want (drop=nxt_time);
  set have end=end_of_have;
  by cust_nbr merchant txn_amt notsorted;
  if end_of_have=0 then set have (firstobs=2 keep=txn_date txn_time rename=(txn_date=nxt_date txn_time=nxt_time));

  if last.txn_amt=0 and dhms(nxt_date,0,0,nxt_time)-dhms(txn_date,0,0,txn_time)&amp;lt;='02:00:00't then delete;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The NOTSORTED option allows you to treat the data as physically grouped, but not necessarily in ascending or descending order.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; IF END_OF_HAVE then set have (firstobs=2 ...)&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;statement reads ahead oneobservation to retrieve the upcoming txn_time, renamed to nxt_time.&amp;nbsp; &amp;nbsp;But when the first SET statement has read the last obs of the data set (END_OF_HAVE=1), the second (conditional) SET does not read (otherwise it would pre-maturely end the data step).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The other thing to note here, is the DELETE statement, which filters out the unwanted "duplicates"&amp;nbsp; (i.e. within 2 hours of the next matching transaction).&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 May 2021 12:24:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dedup-if-the-difference-between-the-transaction-time-is-within-2/m-p/734095#M228723</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2021-05-05T12:24:07Z</dc:date>
    </item>
    <item>
      <title>Re: Dedup if the difference between the transaction time is within 2 hours</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dedup-if-the-difference-between-the-transaction-time-is-within-2/m-p/734097#M228725</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt;&amp;nbsp;Thanks for taking a look at my query. Actually the data is at transaction level in which the dedupable records might not be consecutive always.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 05:13:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dedup-if-the-difference-between-the-transaction-time-is-within-2/m-p/734097#M228725</guid>
      <dc:creator>pk1206</dc:creator>
      <dc:date>2021-04-15T05:13:46Z</dc:date>
    </item>
    <item>
      <title>Re: Dedup if the difference between the transaction time is within 2 hours</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dedup-if-the-difference-between-the-transaction-time-is-within-2/m-p/734102#M228730</link>
      <description>&lt;P&gt;Are the data sorted in any way?&amp;nbsp; Possibly by customer?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 05:32:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dedup-if-the-difference-between-the-transaction-time-is-within-2/m-p/734102#M228730</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2021-04-15T05:32:22Z</dc:date>
    </item>
    <item>
      <title>Re: Dedup if the difference between the transaction time is within 2 hours</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dedup-if-the-difference-between-the-transaction-time-is-within-2/m-p/734105#M228732</link>
      <description>&lt;P&gt;No, the real time data is not sorted as I mentioned that it is on a transaction level.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I tried sorting the data on customer and run the code provided above but getting below error in the log.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if last.txn_amt=0 and dhms(nxt_date,,nxt_time) - dhms(txn_date,,txn_time)&amp;lt;='02:00:00't then&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#993300"&gt;ERROR 159-185:&lt;/FONT&gt; Null parameters for DHMS are invalid.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 05:54:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dedup-if-the-difference-between-the-transaction-time-is-within-2/m-p/734105#M228732</guid>
      <dc:creator>pk1206</dc:creator>
      <dc:date>2021-04-15T05:54:06Z</dc:date>
    </item>
    <item>
      <title>Re: Dedup if the difference between the transaction time is within 2 hours</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dedup-if-the-difference-between-the-transaction-time-is-within-2/m-p/734108#M228734</link>
      <description>&lt;P&gt;I've corrected the DHMS function arguments.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 06:01:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dedup-if-the-difference-between-the-transaction-time-is-within-2/m-p/734108#M228734</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2021-04-15T06:01:19Z</dc:date>
    </item>
    <item>
      <title>Re: Dedup if the difference between the transaction time is within 2 hours</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dedup-if-the-difference-between-the-transaction-time-is-within-2/m-p/734114#M228738</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt;&amp;nbsp;, but is there a possible solution to make this code work even if the data is not sorted ? And will this code work if I can get my data sorted, say on customer number alone or with any other variable in combination ?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 06:53:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dedup-if-the-difference-between-the-transaction-time-is-within-2/m-p/734114#M228738</guid>
      <dc:creator>pk1206</dc:creator>
      <dc:date>2021-04-15T06:53:36Z</dc:date>
    </item>
    <item>
      <title>Re: Dedup if the difference between the transaction time is within 2 hours</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dedup-if-the-difference-between-the-transaction-time-is-within-2/m-p/734206#M228760</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards expandtabs truncover;
input cust_nbr :$80.	txn_id :$40.	merchant :$40.	txn_amt	acct_num :$40.	txn_date :date9.	txn_time :time8.;
format txn_date date9.	txn_time time8.;
cards;
11111111111111111111	A1234	XYZ	1000	0123456789	17Jan2021	23:59:57
11111111111111111111	B9021	XYZ	1000	0123456789	18Jan2021	0:00:03
11111111111111111111	V7619	XYZ	2000	0123456789	18Jan2021	0:00:08
11111111111111111111	W8911	XYZ	2000	0123456789	18Jan2021	0:00:20
22222222222222222	J0569	ABC	3000	9876543210	17Jan2021	8:00:02
22222222222222222	T2801	ABC	3000	9876543210	18Jan2021	9:00:07
;

data have;
 set have;
 datetime=dhms(txn_date,0,0,txn_time);
run;

data temp;
 set have;
 by cust_nbr merchant txn_amt;
 dif=dif(datetime);
 if first.txn_amt then call missing(dif);
run;
data temp;
 set temp;
 by cust_nbr merchant txn_amt;
 if first.txn_amt or dif&amp;gt;60*60*2 then group+1;
run;
data want;
 set temp;
 by group;
 if last.group;
drop dif group datetime;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Apr 2021 12:19:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dedup-if-the-difference-between-the-transaction-time-is-within-2/m-p/734206#M228760</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-04-15T12:19:08Z</dc:date>
    </item>
  </channel>
</rss>

