<?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: Create new IDs in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Test/m-p/691732#M210585</link>
    <description>&lt;P&gt;Emma,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you trying to create the data contained in the third column as defined by the comma delimiter?&amp;nbsp; It appears to work just fine when I run it in Enterprise Guide.&amp;nbsp; &amp;nbsp;See below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you running in SAS Studio?&amp;nbsp; If you are running in SAS studio, make sure your data is all the way over hard against the left margin.&amp;nbsp; &amp;nbsp;The first byte of data needs to start in position 1 with no indentation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&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="jimbarbour_0-1602731701224.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/50683i42B80B4AB64556D0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jimbarbour_0-1602731701224.png" alt="jimbarbour_0-1602731701224.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 15 Oct 2020 03:16:41 GMT</pubDate>
    <dc:creator>jimbarbour</dc:creator>
    <dc:date>2020-10-15T03:16:41Z</dc:date>
    <item>
      <title>Test</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Test/m-p/691724#M210580</link>
      <description />
      <pubDate>Thu, 15 Oct 2020 21:53:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Test/m-p/691724#M210580</guid>
      <dc:creator>Emma8</dc:creator>
      <dc:date>2020-10-15T21:53:02Z</dc:date>
    </item>
    <item>
      <title>Re: Create new IDs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Test/m-p/691730#M210584</link>
      <description>&lt;P&gt;What is the rule you are using to assign ID's?&amp;nbsp; It is not apparent to me.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2020 03:13:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Test/m-p/691730#M210584</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2020-10-15T03:13:08Z</dc:date>
    </item>
    <item>
      <title>Re: Create new IDs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Test/m-p/691732#M210585</link>
      <description>&lt;P&gt;Emma,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you trying to create the data contained in the third column as defined by the comma delimiter?&amp;nbsp; It appears to work just fine when I run it in Enterprise Guide.&amp;nbsp; &amp;nbsp;See below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you running in SAS Studio?&amp;nbsp; If you are running in SAS studio, make sure your data is all the way over hard against the left margin.&amp;nbsp; &amp;nbsp;The first byte of data needs to start in position 1 with no indentation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&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="jimbarbour_0-1602731701224.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/50683i42B80B4AB64556D0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jimbarbour_0-1602731701224.png" alt="jimbarbour_0-1602731701224.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2020 03:16:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Test/m-p/691732#M210585</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2020-10-15T03:16:41Z</dc:date>
    </item>
    <item>
      <title>Re: Create new IDs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Test/m-p/691735#M210588</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/37107"&gt;@jimbarbour&lt;/a&gt; &amp;nbsp; I think the OP wants code to generate the NEWID from the prior two variables - which is why I asked for a rule.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2020 03:19:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Test/m-p/691735#M210588</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2020-10-15T03:19:19Z</dc:date>
    </item>
    <item>
      <title>Re: Create new IDs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Test/m-p/691740#M210592</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards dsd;
input ID $ Datetime :datetime20.;* NEW_ID;
format datetime datetime20.;
cards;
AAC56,25AUG20:02:00:00,1
AAC56,27AUG20:21:00:00,2
AAC56,31AUG20:10:30:00,3
AAC56,02SEP20:20:00:00,4
AAC56,29SEP20:21:43:00,5
AAC56,29SEP20:21:43:00,5
AAC56,29SEP20:22:03:00,5
AAC56,29SEP20:23:03:00,5
AAC56,30SEP20:00:03:00,5
AAC56,30SEP20:01:03:00,5
AAC58,28SEP20:13:45:00,1
AAC58,29SEP20:15:00:00,2
AAC58,29SEP20:16:00:00,2
AAC58,29SEP20:16:00:00,2
AAC58,29SEP20:17:10:00,2
;

%let hour=1;/*Assign your interval here i.e. 1 or 2 etc*/
data want;
 do until(last.id);
  set have;
  by id;
  if first.id=1 or intck('hour',n,datetime)&amp;gt;&amp;amp;hour then new_id=sum(new_id,1);
  n=datetime;
  output;
 end;
 drop n;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Oct 2020 03:53:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Test/m-p/691740#M210592</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-10-15T03:53:49Z</dc:date>
    </item>
  </channel>
</rss>

