<?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: divide rows into groups in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/divide-rows-into-groups/m-p/197012#M36954</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;thank you very much for your answers. It looks very good. Currently I am out of office but tomorrow I will try it and let you know.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 Jul 2015 14:02:34 GMT</pubDate>
    <dc:creator>Vendy</dc:creator>
    <dc:date>2015-07-07T14:02:34Z</dc:date>
    <item>
      <title>divide rows into groups</title>
      <link>https://communities.sas.com/t5/SAS-Programming/divide-rows-into-groups/m-p/197007#M36949</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin: 0 0 1em; font-size: 15px; color: #222222; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: #ffffff;"&gt;Hi,&lt;/P&gt;&lt;P style="margin: 0 0 1em; font-size: 15px; color: #222222; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: #ffffff;"&gt;I need to create some cycle or something else in SAS proc-sql which divide data into groups. &lt;/P&gt;&lt;P style="margin: 0 0 1em; font-size: 15px; color: #222222; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: #ffffff;"&gt;I have data:&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="260" style="border: 1px solid rgb(0, 0, 0); width: 325px; height: 262px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;ID1&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;ID2&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;TIME&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;1234&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;12&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;P&gt;22MAY2015:16:10:00.000&amp;nbsp; &lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;1234&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;12&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;22MAY2015:16:15:00.000&amp;nbsp; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;1234&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;12&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;12JUN2015:6:35:00.000&amp;nbsp;&amp;nbsp; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;1234&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;12&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;12JUN2015:16:35:00.000&amp;nbsp; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;6549&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;45&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;P&gt;15APR2015:16:10:00.000&amp;nbsp; &lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;6549&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;45&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;18APR2015:13:15:00.000&amp;nbsp; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;6549&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;45&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;18APR2015:13:18:00.000&amp;nbsp; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;6549&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;12&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;22MAY2015:14:15:00.000&amp;nbsp; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;6549&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;12&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;22MAY2015:14:20:00.000&amp;nbsp; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P style="margin: 0 0 1em; font-size: 15px; color: #222222; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="margin: 0 0 1em; font-size: 15px; color: #222222; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: #ffffff;"&gt;and I need create new column GROUP where will be the same id for those rows which have same ID1, same ID2 and difference between TIME is max 10 minutes.&lt;/P&gt;&lt;P style="margin: 0 0 1em; font-size: 15px; color: #222222; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: #ffffff;"&gt;Result will be:&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="260" style="border: 1px solid #000000; width: 325px; height: 262px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;ID1&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;ID2&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;TIME&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;GROUP&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;1234&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;12&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;P&gt;22MAY2015:16:10:00.000&amp;nbsp; &lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;1234&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;12&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;22MAY2015:16:15:00.000&amp;nbsp; &lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;1234&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;12&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;12JUN2015:6:35:00.000&amp;nbsp;&amp;nbsp; &lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;1234&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;12&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;12JUN2015:16:35:00.000&amp;nbsp; &lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;6549&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;45&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;P&gt;15APR2015:16:10:00.000&amp;nbsp; &lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;6549&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;45&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;18APR2015:13:15:00.000&amp;nbsp; &lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;6549&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;45&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;18APR2015:13:18:00.000&amp;nbsp; &lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;6549&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;12&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;22MAY2015:14:15:00.000&amp;nbsp; &lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;6549&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;12&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;22MAY2015:14:20:00.000&amp;nbsp; &lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jul 2015 11:37:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/divide-rows-into-groups/m-p/197007#M36949</guid>
      <dc:creator>Vendy</dc:creator>
      <dc:date>2015-07-07T11:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: divide rows into groups</title>
      <link>https://communities.sas.com/t5/SAS-Programming/divide-rows-into-groups/m-p/197008#M36950</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Job for the data step, not SQL.&lt;/P&gt;&lt;P&gt;Use retain/log() together with BY and first./last. logic.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jul 2015 12:14:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/divide-rows-into-groups/m-p/197008#M36950</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2015-07-07T12:14:13Z</dc:date>
    </item>
    <item>
      <title>Re: divide rows into groups</title>
      <link>https://communities.sas.com/t5/SAS-Programming/divide-rows-into-groups/m-p/197009#M36951</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unfortunatelly I am new in SAS so data step I know only a little.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: inherit; font-size: inherit; line-height: 1.5em;"&gt;And it is possible that one group will have more than two rows.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jul 2015 12:18:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/divide-rows-into-groups/m-p/197009#M36951</guid>
      <dc:creator>Vendy</dc:creator>
      <dc:date>2015-07-07T12:18:19Z</dc:date>
    </item>
    <item>
      <title>Re: divide rows into groups</title>
      <link>https://communities.sas.com/t5/SAS-Programming/divide-rows-into-groups/m-p/197010#M36952</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You should verify the output but I think this will get you the correct solution:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;infile cards dsd;&lt;/P&gt;&lt;P&gt;informat id1 id2 8. time datetime.;&lt;/P&gt;&lt;P&gt;format id1 id2 8. time datetime.;&lt;/P&gt;&lt;P&gt;input ID1 ID2 TIME;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;1234,12,22MAY2015:16:10:00.000&lt;/P&gt;&lt;P&gt;1234,12,22MAY2015:16:15:00.000&lt;/P&gt;&lt;P&gt;1234,12,12JUN2015:6:35:00.000 &lt;/P&gt;&lt;P&gt;1234,12,12JUN2015:16:35:00.000&lt;/P&gt;&lt;P&gt;6549,45,15APR2015:16:10:00.000&lt;/P&gt;&lt;P&gt;6549,45,18APR2015:13:15:00.000&lt;/P&gt;&lt;P&gt;6549,45,18APR2015:13:18:00.000&lt;/P&gt;&lt;P&gt;6549,12,22MAY2015:14:15:00.000&lt;/P&gt;&lt;P&gt;6549,12,22MAY2015:14:20:00.000&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=have;by id1 id2 time;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want(drop=_:);&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;by id1 id2 time;&lt;/P&gt;&lt;P&gt;format _l_time datetime.;&lt;/P&gt;&lt;P&gt;_l_time = lag(time);&lt;/P&gt;&lt;P&gt;if not first.id1 and not first.id2 then do;&lt;/P&gt;&lt;P&gt; _diff_time = (time - _l_time)/60;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;if first.id2 or _diff_time &amp;gt; 10 then group + 1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jul 2015 13:12:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/divide-rows-into-groups/m-p/197010#M36952</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2015-07-07T13:12:55Z</dc:date>
    </item>
    <item>
      <title>Re: divide rows into groups</title>
      <link>https://communities.sas.com/t5/SAS-Programming/divide-rows-into-groups/m-p/197011#M36953</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;H3 style="color: #353535; font-family: Lato, sans-serif; background-color: #f0f1f2;"&gt;Code: Program&lt;/H3&gt;&lt;PRE class="sce-render" style="font-family: 'Courier New', Menlo, 'Lucida Console'; font-size: 16px;"&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;data&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;have&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;infile&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;cards&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;truncover&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;expandtabs&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;input&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;id1&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;id2&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;time&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;:&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="format" style="color: #008080;"&gt;anydtdtm30.&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;format&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;time&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="format" style="color: #008080;"&gt;datetime.&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;cards&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1234 12 22MAY2015:16:10:00.000 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1234 12 22MAY2015:16:15:00.000 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1234 12 12JUN2015:6:35:00.000&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1234 12 12JUN2015:16:35:00.000 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;6549 45 15APR2015:16:10:00.000 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;6549 45 18APR2015:13:15:00.000 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;6549 45 18APR2015:13:18:00.000 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;6549 12 22MAY2015:14:15:00.000 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;6549 12 22MAY2015:14:20:00.000 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;run&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;data&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;want&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;set&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;have&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;by&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;id1&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;id2&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;notsorted&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;if&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;first.id2&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;or&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;dif&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;time&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;gt&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;10&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;*&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;60&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;then&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;group&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;+&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;run&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jul 2015 13:28:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/divide-rows-into-groups/m-p/197011#M36953</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-07-07T13:28:25Z</dc:date>
    </item>
    <item>
      <title>Re: divide rows into groups</title>
      <link>https://communities.sas.com/t5/SAS-Programming/divide-rows-into-groups/m-p/197012#M36954</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;thank you very much for your answers. It looks very good. Currently I am out of office but tomorrow I will try it and let you know.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jul 2015 14:02:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/divide-rows-into-groups/m-p/197012#M36954</guid>
      <dc:creator>Vendy</dc:creator>
      <dc:date>2015-07-07T14:02:34Z</dc:date>
    </item>
    <item>
      <title>Re: divide rows into groups</title>
      <link>https://communities.sas.com/t5/SAS-Programming/divide-rows-into-groups/m-p/197013#M36955</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much. It works. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jul 2015 06:27:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/divide-rows-into-groups/m-p/197013#M36955</guid>
      <dc:creator>Vendy</dc:creator>
      <dc:date>2015-07-08T06:27:17Z</dc:date>
    </item>
    <item>
      <title>Re: divide rows into groups</title>
      <link>https://communities.sas.com/t5/SAS-Programming/divide-rows-into-groups/m-p/197014#M36956</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much. It works. Unfortunately it is not possible to mark two answers as 'correct'. Your answer also is correct.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jul 2015 06:31:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/divide-rows-into-groups/m-p/197014#M36956</guid>
      <dc:creator>Vendy</dc:creator>
      <dc:date>2015-07-08T06:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: divide rows into groups</title>
      <link>https://communities.sas.com/t5/SAS-Programming/divide-rows-into-groups/m-p/347536#M80295</link>
      <description>That is great code. Thanks</description>
      <pubDate>Wed, 05 Apr 2017 22:46:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/divide-rows-into-groups/m-p/347536#M80295</guid>
      <dc:creator>rgettys</dc:creator>
      <dc:date>2017-04-05T22:46:40Z</dc:date>
    </item>
    <item>
      <title>Re: divide rows into groups</title>
      <link>https://communities.sas.com/t5/SAS-Programming/divide-rows-into-groups/m-p/347538#M80296</link>
      <description>&lt;P&gt;Using Ksharp's method, &amp;nbsp;how could I&amp;nbsp;reset values each time id1 is changed?&lt;/P&gt;</description>
      <pubDate>Wed, 05 Apr 2017 22:54:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/divide-rows-into-groups/m-p/347538#M80296</guid>
      <dc:creator>rgettys</dc:creator>
      <dc:date>2017-04-05T22:54:11Z</dc:date>
    </item>
    <item>
      <title>Re: divide rows into groups</title>
      <link>https://communities.sas.com/t5/SAS-Programming/divide-rows-into-groups/m-p/347680#M80369</link>
      <description>&lt;P&gt;Add one more line code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="sce-render"&gt;&lt;SPAN class="sec-keyword"&gt;data&lt;/SPAN&gt; &lt;SPAN class="text"&gt;want&lt;/SPAN&gt;&lt;SPAN class="sep"&gt;;&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN class="keyword"&gt;set&lt;/SPAN&gt; &lt;SPAN class="text"&gt;have&lt;/SPAN&gt;&lt;SPAN class="sep"&gt;;&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN class="keyword"&gt;by&lt;/SPAN&gt; &lt;SPAN class="text"&gt;id1&lt;/SPAN&gt; &lt;SPAN class="text"&gt;id2&lt;/SPAN&gt; &lt;SPAN class="keyword"&gt;notsorted&lt;/SPAN&gt;&lt;SPAN class="sep"&gt;;&lt;BR /&gt;&lt;/SPAN&gt;if first.id1 then ........................&lt;BR /&gt; &lt;SPAN class="keyword"&gt;if&lt;/SPAN&gt; &lt;SPAN class="text"&gt;first.id2&lt;/SPAN&gt; &lt;SPAN class="keyword"&gt;or&lt;/SPAN&gt; &lt;SPAN class="keyword"&gt;dif&lt;/SPAN&gt;&lt;SPAN class="sep"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword"&gt;time&lt;/SPAN&gt;&lt;SPAN class="sep"&gt;)&lt;/SPAN&gt; &lt;SPAN class="text"&gt;gt&lt;/SPAN&gt; &lt;SPAN class="numeric"&gt;10&lt;/SPAN&gt;&lt;SPAN class="sep"&gt;*&lt;/SPAN&gt;&lt;SPAN class="numeric"&gt;60&lt;/SPAN&gt; &lt;SPAN class="keyword"&gt;then&lt;/SPAN&gt; &lt;SPAN class="keyword"&gt;group&lt;/SPAN&gt;&lt;SPAN class="sep"&gt;+&lt;/SPAN&gt;&lt;SPAN class="numeric"&gt;1&lt;/SPAN&gt;&lt;SPAN class="sep"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword"&gt;run&lt;/SPAN&gt;&lt;SPAN class="sep"&gt;;&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Apr 2017 12:41:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/divide-rows-into-groups/m-p/347680#M80369</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-04-06T12:41:17Z</dc:date>
    </item>
  </channel>
</rss>

