<?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: Duplicating rows following condition in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Duplicating-rows-following-condition/m-p/274674#M19058</link>
    <description>&lt;P&gt;Yes, do loops:&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  do i=0 to datab;
    datac=datac+i;
    output;
  end;
run;&lt;/PRE&gt;
&lt;P&gt;This creates a loop going from 0 to your number. &amp;nbsp;The record is then output once for each of these loops, so the first time it will be datac+0 -&amp;gt; output, then datac+1 output etc.&lt;/P&gt;</description>
    <pubDate>Thu, 02 Jun 2016 14:11:34 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2016-06-02T14:11:34Z</dc:date>
    <item>
      <title>Duplicating rows following condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Duplicating-rows-following-condition/m-p/274671#M19057</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DataA DataB DataC&lt;/P&gt;&lt;P&gt;ajbg &amp;nbsp; 34 &amp;nbsp; 31/01/2000&lt;/P&gt;&lt;P&gt;hytv &amp;nbsp; 20 &amp;nbsp; 31/08/1995&lt;/P&gt;&lt;P&gt;ytffg &amp;nbsp; 54 &amp;nbsp; 28/02/2005&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to duplicate rows for each row. How many times? Exactly the number of time of DataB: 34 times for the first row, 20 for the second one, 54 for the third, in the way we have something like that at the end.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DataA DataB DataC&lt;/P&gt;&lt;P&gt;ajbg &amp;nbsp; 34 &amp;nbsp; 31/01/2000&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ajbg &amp;nbsp; 33 &amp;nbsp; 29/02/2000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ajbg &amp;nbsp; 32 &amp;nbsp; 31/03/2000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ajbg &amp;nbsp; 31 &amp;nbsp; 30/04/2000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ajbg &amp;nbsp; 30 &amp;nbsp; 31/05/2000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;hytv &amp;nbsp; 20 &amp;nbsp; 31/08/1995&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;hytv &amp;nbsp; 19 &amp;nbsp; 30/09/1995&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;hytv &amp;nbsp; 18 &amp;nbsp; 31/10/1995&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;hytv &amp;nbsp; 17 &amp;nbsp; 30/11/1995&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;hytv &amp;nbsp; 16 &amp;nbsp; 31/12/1995&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;hytv &amp;nbsp; 15 &amp;nbsp; 31/01/1996&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;ytffg &amp;nbsp; 54 &amp;nbsp; 28/02/2005&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ytffg &amp;nbsp; 53 &amp;nbsp; 31/03/2005&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ytffg &amp;nbsp; 52 &amp;nbsp; 30/04/2005&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ytffg &amp;nbsp; 51 &amp;nbsp; 31/05/2005&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ytffg &amp;nbsp; 50 &amp;nbsp; 30/06/2005&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is there a way to do this? Thanks for help, I am only a beginner on SAS&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2016 14:07:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Duplicating-rows-following-condition/m-p/274671#M19057</guid>
      <dc:creator>fabdu92</dc:creator>
      <dc:date>2016-06-02T14:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicating rows following condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Duplicating-rows-following-condition/m-p/274674#M19058</link>
      <description>&lt;P&gt;Yes, do loops:&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  do i=0 to datab;
    datac=datac+i;
    output;
  end;
run;&lt;/PRE&gt;
&lt;P&gt;This creates a loop going from 0 to your number. &amp;nbsp;The record is then output once for each of these loops, so the first time it will be datac+0 -&amp;gt; output, then datac+1 output etc.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2016 14:11:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Duplicating-rows-following-condition/m-p/274674#M19058</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-06-02T14:11:34Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicating rows following condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Duplicating-rows-following-condition/m-p/274693#M19059</link>
      <description>&lt;P&gt;Assuming your dates for datac are actually SAS date values and not characters perhaps:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data want;
   set have ;
   do datab=datab to 1 by -1;
      output;
      datac = intnx('month',datac,-1,'e');
   end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Jun 2016 14:32:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Duplicating-rows-following-condition/m-p/274693#M19059</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-06-02T14:32:39Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicating rows following condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Duplicating-rows-following-condition/m-p/274907#M19073</link>
      <description>&lt;P&gt;To obtain&amp;nbsp;&lt;EM&gt;ascending&lt;/EM&gt; months, simply replace &lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#008080"&gt;-1&lt;/FONT&gt;&lt;/STRONG&gt; with &lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#008080"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; in the third argument of the INTNX function used in ballardw's approach.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2016 09:59:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Duplicating-rows-following-condition/m-p/274907#M19073</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-06-03T09:59:12Z</dc:date>
    </item>
  </channel>
</rss>

