<?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: need to split first 2 nums of same id by 2 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/need-to-split-first-2-nums-of-same-id-by-2/m-p/503283#M134458</link>
    <description>&lt;P&gt;Why is 101,2 the only record split?&lt;/P&gt;</description>
    <pubDate>Thu, 11 Oct 2018 00:22:17 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2018-10-11T00:22:17Z</dc:date>
    <item>
      <title>need to split first 2 nums of same id by 2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-split-first-2-nums-of-same-id-by-2/m-p/503042#M134366</link>
      <description>&lt;PRE&gt;data have;
infile datalines dsd truncover;
input id num (start end) (:date9.);
format start end date9.;
datalines4;
101,2,12MAR2018,18MAR2018
101,3,15MAR2018,19MAR2018
101,4,20MAR2018,29MAR2018
102,2,12JAN2018,19JAN2018
102,3,20JAN2018,28JAN2018
102,4,29JAN2018,12FEB2018
102,5,13FEB2018,18FEB2018
102,6,19FEB2018,28FEB2018
;;;;
run;

data want;
infile datalines dsd truncover;
input id num (start end) (:date9.);
format start end date9.;
datalines4;
101,2,12MAR2018,13MAR2018
101,2,14MAR2018,15MAR2018
101,2,16MAR2018,18MAR2018
101,3,15MAR2018,19MAR2018
101,4,20MAR2018,29MAR2018
102,2,12JAN2018,19JAN2018
102,3,20JAN2018,28JAN2018
102,4,29JAN2018,12FEB2018
102,5,13FEB2018,18FEB2018
102,6,19FEB2018,28FEB2018
;;;;
run;&lt;/PRE&gt;
&lt;P&gt;I need to split first nums with 2 days duration for 2 times as shown in want. any suggestion? if the total duration is less than 4 then it should split in num3 for all id's.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Oct 2018 12:10:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-split-first-2-nums-of-same-id-by-2/m-p/503042#M134366</guid>
      <dc:creator>vraj1</dc:creator>
      <dc:date>2018-10-10T12:10:08Z</dc:date>
    </item>
    <item>
      <title>Re: need to split first 2 nums of same id by 2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-split-first-2-nums-of-same-id-by-2/m-p/503283#M134458</link>
      <description>&lt;P&gt;Why is 101,2 the only record split?&lt;/P&gt;</description>
      <pubDate>Thu, 11 Oct 2018 00:22:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-split-first-2-nums-of-same-id-by-2/m-p/503283#M134458</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-10-11T00:22:17Z</dc:date>
    </item>
    <item>
      <title>Re: need to split first 2 nums of same id by 2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-split-first-2-nums-of-same-id-by-2/m-p/503319#M134470</link>
      <description>&lt;PRE&gt;&lt;BR /&gt;data have;&lt;BR /&gt;infile datalines dsd truncover;&lt;BR /&gt;input id num (start end) (:date9.);&lt;BR /&gt;format start end date9.;&lt;BR /&gt;datalines4;&lt;BR /&gt;101,2,12MAR2018,13MAR2018&lt;BR /&gt;101,3,16MAR2018,19MAR2018&lt;BR /&gt;101,4,20MAR2018,29MAR2018&lt;BR /&gt;102,2,12JAN2018,19JAN2018&lt;BR /&gt;102,3,20JAN2018,28JAN2018&lt;BR /&gt;102,4,29JAN2018,12FEB2018&lt;BR /&gt;102,5,13FEB2018,18FEB2018&lt;BR /&gt;102,6,19FEB2018,28FEB2018&lt;BR /&gt;;;;;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;data need;&lt;BR /&gt; set have;&lt;BR /&gt; by id num;&lt;BR /&gt; retain end1;&lt;BR /&gt; format end1 date9.;&lt;BR /&gt; If first.id then do;&lt;BR /&gt; do i=1 to 3;&lt;BR /&gt; if i=1 then do; start=start; end1=start+1; output; end;&lt;BR /&gt; if i=2 then do; start=end1+1; end1=start+1; output; end;&lt;BR /&gt; if i=3 then do; start=end1+1; end1=end;output; end;&lt;BR /&gt;If end1=end then i =4;&lt;BR /&gt; end;&lt;BR /&gt; end;&lt;BR /&gt;Else do;&lt;BR /&gt;End1=end; output; end;&lt;BR /&gt;run;&lt;/PRE&gt;
&lt;P&gt;i used the below code but it somehow doesnt split if the first num doesnt have enough duration&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Oct 2018 15:15:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-split-first-2-nums-of-same-id-by-2/m-p/503319#M134470</guid>
      <dc:creator>vraj1</dc:creator>
      <dc:date>2018-10-11T15:15:10Z</dc:date>
    </item>
  </channel>
</rss>

