<?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: Adding additional rows based on time variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Adding-additional-rows-based-on-time-variable/m-p/368198#M87784</link>
    <description>&lt;P&gt;Something like:&lt;/P&gt;
&lt;PRE&gt;data have;
  input id time d1 d2 e1;
datalines;
1 -0.25 . . 0
1 0 . . 1
1 3 . . 0
1 672.25 . . 0
2 0 . . 0
2 0 . . 1
2 3 21300 9.966 0
2 669.5 2760 7.923 0
2 670.0833 . . 1
2 673.25 31400 10.355 0
2 1509.1667 3760 8.232 0
2 1509.1667 . . 1
2 1512.1667 24100 10.09 0
2 2181.4167 4170 8.336 0
2 2181.5 . . 1
2 2184.5333 26900 10.2 0
2 2853.5 . . 1
2 3525.7917 . . 1
2 3981.5 9310 9.139 0
;
run;

data want (drop=i);
  set have;
  if 0 &amp;lt;= time &amp;lt;= 1 then do;
    do i=time to 1 by 0.1;
      time=i;
      output;
    end;
  end;
  else if 1 &amp;lt; time &amp;lt;= 3 then do;
    do i=time to 3 by 0.5;
      time=i;
      output;
    end;
  end;
  else output;
run; &lt;/PRE&gt;</description>
    <pubDate>Mon, 19 Jun 2017 08:40:46 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2017-06-19T08:40:46Z</dc:date>
    <item>
      <title>Adding additional rows based on time variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-additional-rows-based-on-time-variable/m-p/368196#M87782</link>
      <description>&lt;P&gt;I'm trying to create additional rows based on time variable.&lt;/P&gt;&lt;P&gt;from time=0 to time=1, additional rows to be created with an increment of 0.1&lt;/P&gt;&lt;P&gt;from time=1 to time=3, additional rows to be created with an increment of 0.5.&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;Please find the input and output datasets below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA HAVE;&lt;BR /&gt;INPUT ID TIME D1 D2 E1;&lt;BR /&gt;DATALINES;&lt;BR /&gt;1 -0.25 . . 0&lt;BR /&gt;1 0 . . 1&lt;BR /&gt;1 3 . . 0&lt;BR /&gt;1 672.25 . . 0&lt;BR /&gt;2 0 . . 0&lt;BR /&gt;2 0 . . 1&lt;BR /&gt;2 3 21300 9.966 0&lt;BR /&gt;2 669.5 2760 7.923 0&lt;BR /&gt;2 670.0833 . . 1&lt;BR /&gt;2 673.25 31400 10.355 0&lt;BR /&gt;2 1509.1667 3760 8.232 0&lt;BR /&gt;2 1509.1667 . . 1&lt;BR /&gt;2 1512.1667 24100 10.09 0&lt;BR /&gt;2 2181.4167 4170 8.336 0&lt;BR /&gt;2 2181.5 . . 1&lt;BR /&gt;2 2184.5333 26900 10.2 0&lt;BR /&gt;2 2853.5 . . 1&lt;BR /&gt;2 3525.7917 . . 1&lt;BR /&gt;2 3981.5 9310 9.139 0&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;DATA WANT;&lt;BR /&gt;INPUT ID TIME D1 D2 E;&lt;BR /&gt;DATALINES;&lt;BR /&gt;1 -0.25 . . 0&lt;BR /&gt;1 0 . . 1&lt;BR /&gt;1 0.2 . . 0&lt;BR /&gt;1 0.4 . . 0&lt;BR /&gt;1 0.6 . . 0&lt;BR /&gt;1 0.8 . . 0&lt;BR /&gt;1 1 . . 0&lt;BR /&gt;1 1.5 . . 0&lt;BR /&gt;1 2 . . 0&lt;BR /&gt;1 2.5 . . 0&lt;BR /&gt;1 3 . . 0&lt;BR /&gt;1 672.25 . . 0&lt;BR /&gt;2 0 . . 0&lt;BR /&gt;2 0 . . 1&lt;BR /&gt;1 0 . . 1&lt;BR /&gt;1 0.2 . . 0&lt;BR /&gt;1 0.4 . . 0&lt;BR /&gt;1 0.6 . . 0&lt;BR /&gt;1 0.8 . . 0&lt;BR /&gt;1 1 . . 0&lt;BR /&gt;1 1.5 . . 0&lt;BR /&gt;1 2 . . 0&lt;BR /&gt;1 2.5 . . 0&lt;BR /&gt;2 3 21300 9.966 0&lt;BR /&gt;2 669.5 2760 7.923 0&lt;BR /&gt;2 670.0833 . . 1&lt;BR /&gt;2 673.25 31400 10.355 0&lt;BR /&gt;2 1509.1667 3760 8.232 0&lt;BR /&gt;2 1509.1667 . . 1&lt;BR /&gt;2 1512.1667 24100 10.09 0&lt;BR /&gt;2 2181.4167 4170 8.336 0&lt;BR /&gt;2 2181.5 . . 1&lt;BR /&gt;2 2184.5333 26900 10.2 0&lt;BR /&gt;2 2853.5 . . 1&lt;BR /&gt;2 3525.7917 . . 1&lt;BR /&gt;2 3981.5 9310 9.139 0&lt;BR /&gt;;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 10:57:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-additional-rows-based-on-time-variable/m-p/368196#M87782</guid>
      <dc:creator>Nsas</dc:creator>
      <dc:date>2017-06-19T10:57:43Z</dc:date>
    </item>
    <item>
      <title>Re: Adding additional rows based on time variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-additional-rows-based-on-time-variable/m-p/368198#M87784</link>
      <description>&lt;P&gt;Something like:&lt;/P&gt;
&lt;PRE&gt;data have;
  input id time d1 d2 e1;
datalines;
1 -0.25 . . 0
1 0 . . 1
1 3 . . 0
1 672.25 . . 0
2 0 . . 0
2 0 . . 1
2 3 21300 9.966 0
2 669.5 2760 7.923 0
2 670.0833 . . 1
2 673.25 31400 10.355 0
2 1509.1667 3760 8.232 0
2 1509.1667 . . 1
2 1512.1667 24100 10.09 0
2 2181.4167 4170 8.336 0
2 2181.5 . . 1
2 2184.5333 26900 10.2 0
2 2853.5 . . 1
2 3525.7917 . . 1
2 3981.5 9310 9.139 0
;
run;

data want (drop=i);
  set have;
  if 0 &amp;lt;= time &amp;lt;= 1 then do;
    do i=time to 1 by 0.1;
      time=i;
      output;
    end;
  end;
  else if 1 &amp;lt; time &amp;lt;= 3 then do;
    do i=time to 3 by 0.5;
      time=i;
      output;
    end;
  end;
  else output;
run; &lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Jun 2017 08:40:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-additional-rows-based-on-time-variable/m-p/368198#M87784</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-06-19T08:40:46Z</dc:date>
    </item>
    <item>
      <title>Re: Adding additional rows based on time variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-additional-rows-based-on-time-variable/m-p/368203#M87785</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;: Thanks. In your code the increment from time=0 to time=1 by 0.1 works but not the time=1 to time=3 by 0.5. not sure why?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 09:07:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-additional-rows-based-on-time-variable/m-p/368203#M87785</guid>
      <dc:creator>Nsas</dc:creator>
      <dc:date>2017-06-19T09:07:10Z</dc:date>
    </item>
    <item>
      <title>Re: Adding additional rows based on time variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-additional-rows-based-on-time-variable/m-p/368215#M87787</link>
      <description>&lt;P&gt;There is only one record in your test data which is within 1 and 3 and because that row is 3, do i=3 to 3 by 0.5 doesn't do anything. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 09:44:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-additional-rows-based-on-time-variable/m-p/368215#M87787</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-06-19T09:44:09Z</dc:date>
    </item>
  </channel>
</rss>

