<?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: New group should be created as a column based on the matches of the records in two different gro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/New-group-should-be-created-as-a-column-based-on-the-matches-of/m-p/806052#M317541</link>
    <description>&lt;P&gt;Hi Kurt,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the quick response, the code which is sent is working fine with the testing data which we have&lt;/P&gt;&lt;P&gt;and we will check with the actual data which contains 4M rows for different days.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 05 Apr 2022 13:30:09 GMT</pubDate>
    <dc:creator>Sastech</dc:creator>
    <dc:date>2022-04-05T13:30:09Z</dc:date>
    <item>
      <title>New group should be created as a column based on the matches of the records in two different group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-group-should-be-created-as-a-column-based-on-the-matches-of/m-p/806025#M317530</link>
      <description>&lt;P&gt;If group 1 of gids matches with group 2 then-new group_id should be generated as 1 until the matches break from one group to another group and also it should check new comparing groups start time must fall on previous group start and end time.&lt;/P&gt;&lt;P&gt;Now, groups, 1 and 2 will be under the same new_group 1, and the minimum start time and maximum end time of both groups will be taken as &lt;STRONG&gt;start&lt;/STRONG&gt; and &lt;STRONG&gt;end&lt;/STRONG&gt; times for the next group check.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For &lt;STRONG&gt;Example&lt;/STRONG&gt;, if group 10 will not match with the previous group’s ids and the time window also does not match with any other new_group window .so group 10 will be a separate group then-new group_id is 2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We have provided the screenshot of the input and output for grouping.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Note&lt;/STRONG&gt;: start_time and end_time are in character in the below query but it is in datetime20. Format&lt;/P&gt;&lt;P&gt;In our data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;input group 1-2 gids $4-8 start_time $10-25 end_time $27-42 ;&lt;BR /&gt;datalines;&lt;BR /&gt;1 85-51 16FEB22:00:03:00 16FEB22:00:55:00&lt;BR /&gt;1 85-52 16FEB22:00:03:00 16FEB22:00:55:00&lt;BR /&gt;2 85-52 16FEB22:00:07:00 16FEB22:01:38:00&lt;BR /&gt;2 85-53 16FEB22:00:07:00 16FEB22:01:38:00&lt;BR /&gt;3 85-53 16FEB22:00:16:00 16FEB22:01:40:00&lt;BR /&gt;3 85-54 16FEB22:00:16:00 16FEB22:01:40:00&lt;BR /&gt;4 85-54 16FEB22:01:18:00 16FEB22:01:58:00&lt;BR /&gt;4 85-55 16FEB22:01:18:00 16FEB22:01:58:00&lt;BR /&gt;5 85-55 16FEB22:01:20:00 16FEB22:02:51:00&lt;BR /&gt;5 85-56 16FEB22:01:20:00 16FEB22:02:51:00&lt;BR /&gt;6 85-56 16FEB22:01:21:00 16FEB22:03:50:00&lt;BR /&gt;6 85-57 16FEB22:01:21:00 16FEB22:03:50:00&lt;BR /&gt;7 85-57 16FEB22:02:35:00 16FEB22:04:17:00&lt;BR /&gt;7 85-58 16FEB22:02:35:00 16FEB22:04:17:00&lt;BR /&gt;8 85-58 16FEB22:02:47:00 16FEB22:05:39:00&lt;BR /&gt;8 85-60 16FEB22:02:47:00 16FEB22:05:39:00&lt;BR /&gt;9 85-60 16FEB22:03:59:00 16FEB22:05:39:00&lt;BR /&gt;9 89-51 16FEB22:03:59:00 16FEB22:05:39:00&lt;BR /&gt;10 85-66 16FEB22:10:11:00 16FEB22:10:52:00&lt;BR /&gt;10 85-67 16FEB22:10:11:00 16FEB22:10:52:00&lt;BR /&gt;11 89-51 16FEB22:05:01:00 16FEB22:06:10:00&lt;BR /&gt;11 89-52 16FEB22:05:01:00 16FEB22:06:10:00&lt;BR /&gt;12 89-52 16FEB22:05:02:00 16FEB22:06:10:00&lt;BR /&gt;12 89-53 16FEB22:05:02:00 16FEB22:06:10:00&lt;BR /&gt;13 89-72 16FEB22:13:57:00 16FEB22:15:19:00&lt;BR /&gt;13 89-73 16FEB22:13:57:00 16FEB22:15:19:00&lt;BR /&gt;13 89-75 16FEB22:13:57:00 16FEB22:15:19:00&lt;BR /&gt;14 89-73 16FEB22:14:00:00 16FEB22:15:19:00&lt;BR /&gt;14 89-75 16FEB22:14:00:00 16FEB22:15:19:00&lt;BR /&gt;14 89-76 16FEB22:14:00:00 16FEB22:15:19:00&lt;BR /&gt;15 89-80 16FEB22:21:11:00 16FEB22:23:05:00&lt;BR /&gt;15 89-81 16FEB22:21:11:00 16FEB22:23:05:00&lt;BR /&gt;16 89-81 16FEB22:21:13:00 17FEB22:00:31:00&lt;BR /&gt;16 89-82 16FEB22:21:13:00 17FEB22:00:31:00&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sastech_0-1649155588598.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/70121iA52E22A65A9487C5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Sastech_0-1649155588598.png" alt="Sastech_0-1649155588598.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;screenshot of input and output&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank You in advance&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2022 10:49:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-group-should-be-created-as-a-column-based-on-the-matches-of/m-p/806025#M317530</guid>
      <dc:creator>Sastech</dc:creator>
      <dc:date>2022-04-05T10:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: New group should be created as a column based on the matches of the records in two different gro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-group-should-be-created-as-a-column-based-on-the-matches-of/m-p/806036#M317533</link>
      <description>&lt;P&gt;I made some changes to your data step, so we get real datetime values, but this is mostly irrelevant for the solution. Just so you can see how such values are read from datalines.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input group gids $ (start_time end_time) (:datetime19.);
format start_time end_time e8601dt19.;
datalines;
1 85-51 16FEB22:00:03:00 16FEB22:00:55:00
1 85-52 16FEB22:00:03:00 16FEB22:00:55:00
2 85-52 16FEB22:00:07:00 16FEB22:01:38:00
2 85-53 16FEB22:00:07:00 16FEB22:01:38:00
3 85-53 16FEB22:00:16:00 16FEB22:01:40:00
3 85-54 16FEB22:00:16:00 16FEB22:01:40:00
4 85-54 16FEB22:01:18:00 16FEB22:01:58:00
4 85-55 16FEB22:01:18:00 16FEB22:01:58:00
5 85-55 16FEB22:01:20:00 16FEB22:02:51:00
5 85-56 16FEB22:01:20:00 16FEB22:02:51:00
6 85-56 16FEB22:01:21:00 16FEB22:03:50:00
6 85-57 16FEB22:01:21:00 16FEB22:03:50:00
7 85-57 16FEB22:02:35:00 16FEB22:04:17:00
7 85-58 16FEB22:02:35:00 16FEB22:04:17:00
8 85-58 16FEB22:02:47:00 16FEB22:05:39:00
8 85-60 16FEB22:02:47:00 16FEB22:05:39:00
9 85-60 16FEB22:03:59:00 16FEB22:05:39:00
9 89-51 16FEB22:03:59:00 16FEB22:05:39:00
10 85-66 16FEB22:10:11:00 16FEB22:10:52:00
10 85-67 16FEB22:10:11:00 16FEB22:10:52:00
11 89-51 16FEB22:05:01:00 16FEB22:06:10:00
11 89-52 16FEB22:05:01:00 16FEB22:06:10:00
12 89-52 16FEB22:05:02:00 16FEB22:06:10:00
12 89-53 16FEB22:05:02:00 16FEB22:06:10:00
13 89-72 16FEB22:13:57:00 16FEB22:15:19:00
13 89-73 16FEB22:13:57:00 16FEB22:15:19:00
13 89-75 16FEB22:13:57:00 16FEB22:15:19:00
14 89-73 16FEB22:14:00:00 16FEB22:15:19:00
14 89-75 16FEB22:14:00:00 16FEB22:15:19:00
14 89-76 16FEB22:14:00:00 16FEB22:15:19:00
15 89-80 16FEB22:21:11:00 16FEB22:23:05:00
15 89-81 16FEB22:21:11:00 16FEB22:23:05:00
16 89-81 16FEB22:21:13:00 17FEB22:00:31:00
16 89-82 16FEB22:21:13:00 17FEB22:00:31:00
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;From that, use a hash object to keep track of new groups:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
by group;
retain newgroup max_newgroup;
if _n_ = 1
then do; /* build a dynamic object which keeps track of gids to newgroup relationship */
  declare hash new ();
  new.definekey("gids");
  new.definedata("newgroup");
  new.definedone();
  max_newgroup = 0;
end;
if first.group and new.find() ne 0
/* at the start of a group, we can't find a match, so we create a new group */
then do;
  max_newgroup + 1;
  newgroup = max_newgroup;
  rc = new.add();
end;
if new.find() ne 0 /* current gids is not found in the hash */
/* since newgroup is either taken from the hash or newly set
  at the start of a group, and retained, we can now add it */
then rc = new.add();
drop max_newgroup rc;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Apr 2022 12:11:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-group-should-be-created-as-a-column-based-on-the-matches-of/m-p/806036#M317533</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-04-05T12:11:44Z</dc:date>
    </item>
    <item>
      <title>Re: New group should be created as a column based on the matches of the records in two different gro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-group-should-be-created-as-a-column-based-on-the-matches-of/m-p/806039#M317534</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input group 1-2 gids $4-8 start_time : datetime20. end_time : datetime20.  ;
format start_time  end_time : datetime20. ;
datalines;
1 85-51 16FEB22:00:03:00 16FEB22:00:55:00
1 85-52 16FEB22:00:03:00 16FEB22:00:55:00
2 85-52 16FEB22:00:07:00 16FEB22:01:38:00
2 85-53 16FEB22:00:07:00 16FEB22:01:38:00
3 85-53 16FEB22:00:16:00 16FEB22:01:40:00
3 85-54 16FEB22:00:16:00 16FEB22:01:40:00
4 85-54 16FEB22:01:18:00 16FEB22:01:58:00
4 85-55 16FEB22:01:18:00 16FEB22:01:58:00
5 85-55 16FEB22:01:20:00 16FEB22:02:51:00
5 85-56 16FEB22:01:20:00 16FEB22:02:51:00
6 85-56 16FEB22:01:21:00 16FEB22:03:50:00
6 85-57 16FEB22:01:21:00 16FEB22:03:50:00
7 85-57 16FEB22:02:35:00 16FEB22:04:17:00
7 85-58 16FEB22:02:35:00 16FEB22:04:17:00
8 85-58 16FEB22:02:47:00 16FEB22:05:39:00
8 85-60 16FEB22:02:47:00 16FEB22:05:39:00
9 85-60 16FEB22:03:59:00 16FEB22:05:39:00
9 89-51 16FEB22:03:59:00 16FEB22:05:39:00
10 85-66 16FEB22:10:11:00 16FEB22:10:52:00
10 85-67 16FEB22:10:11:00 16FEB22:10:52:00
11 89-51 16FEB22:05:01:00 16FEB22:06:10:00
11 89-52 16FEB22:05:01:00 16FEB22:06:10:00
12 89-52 16FEB22:05:02:00 16FEB22:06:10:00
12 89-53 16FEB22:05:02:00 16FEB22:06:10:00
13 89-72 16FEB22:13:57:00 16FEB22:15:19:00
13 89-73 16FEB22:13:57:00 16FEB22:15:19:00
13 89-75 16FEB22:13:57:00 16FEB22:15:19:00
14 89-73 16FEB22:14:00:00 16FEB22:15:19:00
14 89-75 16FEB22:14:00:00 16FEB22:15:19:00
14 89-76 16FEB22:14:00:00 16FEB22:15:19:00
15 89-80 16FEB22:21:11:00 16FEB22:23:05:00
15 89-81 16FEB22:21:11:00 16FEB22:23:05:00
16 89-81 16FEB22:21:13:00 17FEB22:00:31:00
16 89-82 16FEB22:21:13:00 17FEB22:00:31:00
;
run;

data step1;
 set have(keep= start_time  end_time );
 do dt= start_time to end_time ;
  output; 
 end;
 keep dt;
run;
proc sort data=step1 out=step2 nodupkey;by dt;run;
data step3;
 set step2;
 if dif(dt) ne 1 then group+1;
 format dt datetime.;
run;
data want;
 if _n_=1 then do;
  declare hash h(dataset:'step3');
  h.definekey('dt');
  h.definedata('group');
  h.definedone();
 end;
set have;
 do dt= start_time to end_time ;
  call missing(group);
  if h.find()=0 then leave; 
 end;
drop dt;
run;
proc sort data=want;by group;run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Apr 2022 12:29:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-group-should-be-created-as-a-column-based-on-the-matches-of/m-p/806039#M317534</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-04-05T12:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: New group should be created as a column based on the matches of the records in two different gro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-group-should-be-created-as-a-column-based-on-the-matches-of/m-p/806052#M317541</link>
      <description>&lt;P&gt;Hi Kurt,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the quick response, the code which is sent is working fine with the testing data which we have&lt;/P&gt;&lt;P&gt;and we will check with the actual data which contains 4M rows for different days.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2022 13:30:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-group-should-be-created-as-a-column-based-on-the-matches-of/m-p/806052#M317541</guid>
      <dc:creator>Sastech</dc:creator>
      <dc:date>2022-04-05T13:30:09Z</dc:date>
    </item>
    <item>
      <title>Re: New group should be created as a column based on the matches of the records in two different gro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-group-should-be-created-as-a-column-based-on-the-matches-of/m-p/806053#M317542</link>
      <description>&lt;P&gt;Hi Ksharp,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the quick response, the code which is sent is working fine with the testing data which we have&lt;/P&gt;&lt;P&gt;and we will check with the actual data which contains 4M rows for different days.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2022 13:31:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-group-should-be-created-as-a-column-based-on-the-matches-of/m-p/806053#M317542</guid>
      <dc:creator>Sastech</dc:creator>
      <dc:date>2022-04-05T13:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: New group should be created as a column based on the matches of the records in two different gro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-group-should-be-created-as-a-column-based-on-the-matches-of/m-p/806376#M317690</link>
      <description>&lt;P&gt;Problem&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;input group gids $ (start_time end_time) (:datetime19.);&lt;BR /&gt;format start_time end_time e8601dt19.;&lt;BR /&gt;datalines;&lt;BR /&gt;1 1-10 16FEB22:08:32:00 16FEB22:08:58:00&lt;BR /&gt;1 1-11 16FEB22:08:32:00 16FEB22:08:58:00&lt;BR /&gt;1 1-8 16FEB22:07:48:00 16FEB22:08:36:00&lt;BR /&gt;2 1-11 16FEB22:08:33:00 16FEB22:09:16:00&lt;BR /&gt;2 1-12 16FEB22:08:33:00 16FEB22:09:16:00&lt;BR /&gt;6 1-8 16FEB22:07:28:00 16FEB22:08:35:00&lt;BR /&gt;6 2-57 16FEB22:07:28:00 16FEB22:08:35:00&lt;BR /&gt;146 2-56 16FEB22:07:05:00 16FEB22:07:54:00&lt;BR /&gt;146 2-57 16FEB22:07:05:00 16FEB22:07:54:00&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;As per the below code , it searches only first gid of group only but it has to check all gids of a group for matching. If any of the gids in the group matches same newgroup should be populated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if first.group and new.find() ne 0&lt;BR /&gt;/* at the start of a group, we can't find a match, so we create a new group */&lt;BR /&gt;then do;&lt;BR /&gt;max_newgroup + 1;&lt;BR /&gt;newgroup = max_newgroup;&lt;BR /&gt;rc = new.add();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As result of this, 2-56 gid alone goes to new group when we analyzed the code with another set of data. But all belongs to same group. Could you please let us know how to resolve it.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sastech_0-1649270160684.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/70174iA30E986A764C727E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Sastech_0-1649270160684.png" alt="Sastech_0-1649270160684.png" /&gt;&lt;/span&gt;&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/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2022 18:37:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-group-should-be-created-as-a-column-based-on-the-matches-of/m-p/806376#M317690</guid>
      <dc:creator>Sastech</dc:creator>
      <dc:date>2022-04-06T18:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: New group should be created as a column based on the matches of the records in two different gro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-group-should-be-created-as-a-column-based-on-the-matches-of/m-p/806435#M317724</link>
      <description>&lt;P&gt;So we need to first check each group if we can find &lt;U&gt;any&lt;/U&gt; assigned newgroup, and then process the group again to write newgroup:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
if 0 then set have; /* defines variables into the PDV, does nothing else */
retain newgroup max_newgroup;
if _n_ = 1
then do; /* build a dynamic object which keeps track of gids to newgroup relationship */
  declare hash new ();
  new.definekey("gids");
  new.definedata("newgroup");
  new.definedone();
  max_newgroup = 0;
end;
ng = 0;
do until (last.group);
  set have;
  by group;
  if new.find() = 0 then ng = newgroup;
end;
if not ng
then do;
  max_newgroup + 1;
  ng = max_newgroup;
end;
newgroup = ng;
do until (last.group);
  set have;
  by group;
  if new.check() ne 0 /* current gids is not found in the hash */
  then rc = new.add();
  output;
end;
drop max_newgroup rc ng;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Apr 2022 06:15:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-group-should-be-created-as-a-column-based-on-the-matches-of/m-p/806435#M317724</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-04-07T06:15:03Z</dc:date>
    </item>
    <item>
      <title>Re: New group should be created as a column based on the matches of the records in two different gro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-group-should-be-created-as-a-column-based-on-the-matches-of/m-p/808505#M318819</link>
      <description>&lt;P&gt;Hi Kurt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;input gids $ group (start_time end_time) (:datetime19.);&lt;BR /&gt;format start_time end_time e8601dt19.;&lt;BR /&gt;datalines;&lt;BR /&gt;1-10 1 27FEB22:12:32:00 27FEB22:13:04:00&lt;BR /&gt;1-9 1 27FEB22:12:32:00 27FEB22:13:04:00&lt;BR /&gt;2-15 1 27FEB22:12:33:00 27FEB22:13:12:00&lt;BR /&gt;1-4 2 27FEB22:10:00:00 27FEB22:10:51:00&lt;BR /&gt;1-5 2 27FEB22:10:00:00 27FEB22:10:51:00&lt;BR /&gt;1-5 3 27FEB22:10:27:00 27FEB22:11:39:00&lt;BR /&gt;1-6 3 27FEB22:10:27:00 27FEB22:11:39:00&lt;BR /&gt;1-6 4 25FEB22:09:18:00 25FEB22:09:33:00&lt;BR /&gt;1-7 4 25FEB22:09:18:00 25FEB22:09:33:00&lt;BR /&gt;1-7 5 27FEB22:11:33:00 27FEB22:12:39:00&lt;BR /&gt;1-8 5 27FEB22:11:33:00 27FEB22:12:39:00&lt;BR /&gt;1-8 6 27FEB22:11:34:00 27FEB22:12:39:00&lt;BR /&gt;1-9 6 27FEB22:11:34:00 27FEB22:12:39:00&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We have the data for multiple days previously we tried to within a single day of data.&lt;/P&gt;&lt;P&gt;While grouping for multiple days if there is any group that is falling on multiple days like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As per the Screenshot below&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sastech_0-1650359472017.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/70556i0BD3FA0C2129CAAD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Sastech_0-1650359472017.png" alt="Sastech_0-1650359472017.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Group 3 and group 4 should not match even though the gids match but they fall on different dates and there is no continuity in the time frame.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Note:&lt;/STRONG&gt; when we working with multiple dates we are facing this issue. If a group starts from 25th Feb 11:55 PM to 26th Feb 00:35 AM and another group starts at 00:10 AM on 26th Feb and their gids match then it can be a single group.&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/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 09:14:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-group-should-be-created-as-a-column-based-on-the-matches-of/m-p/808505#M318819</guid>
      <dc:creator>Sastech</dc:creator>
      <dc:date>2022-04-19T09:14:00Z</dc:date>
    </item>
  </channel>
</rss>

