<?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: Repeat rows to fill to fill a specific number of rows in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Repeat-rows-to-fill-to-fill-a-specific-number-of-rows/m-p/778567#M247842</link>
    <description>I program in both languages as well, so seeing your solution in R would help me to point out the similar or relevant constructs in SAS but your question is pretty straightforward so someone can definitely help you answer it anyways.</description>
    <pubDate>Thu, 04 Nov 2021 18:01:49 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2021-11-04T18:01:49Z</dc:date>
    <item>
      <title>Repeat rows to fill to fill a specific number of rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Repeat-rows-to-fill-to-fill-a-specific-number-of-rows/m-p/778552#M247832</link>
      <description>&lt;P&gt;Essentially I need to repeat rows of data till I reach a specific number of rows. For example, say I have 5 rows of data I need to fill 12 rows. That is, I have:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;| Index | ID |
:-------:----:
|   1   | A  |
|   2   | B  |
|   3   | C  |
|   4   | D  |
|   5   | E  |&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But I need:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;| Index | ID |
:-------:-----
|   1   |  A |
|   2   |  B |
|   3   |  C |
|   4   |  D |
|   5   |  E |
|   6   |  A |
|   7   |  B |
|   8   |  C |
|   9   |  D |
|  10   |  E |
|  11   |  A |
|  12   |  B |&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This is going to be on a much larger scale.&amp;nbsp; The index does not have to be included.&amp;nbsp; I can think of how to do this in R or Python, but I have very minimal experience in SAS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Nov 2021 17:20:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Repeat-rows-to-fill-to-fill-a-specific-number-of-rows/m-p/778552#M247832</guid>
      <dc:creator>Transcendental</dc:creator>
      <dc:date>2021-11-04T17:20:33Z</dc:date>
    </item>
    <item>
      <title>Re: Repeat rows to fill to fill a specific number of rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Repeat-rows-to-fill-to-fill-a-specific-number-of-rows/m-p/778555#M247833</link>
      <description>How would you do it in R?</description>
      <pubDate>Thu, 04 Nov 2021 17:25:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Repeat-rows-to-fill-to-fill-a-specific-number-of-rows/m-p/778555#M247833</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-11-04T17:25:20Z</dc:date>
    </item>
    <item>
      <title>Re: Repeat rows to fill to fill a specific number of rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Repeat-rows-to-fill-to-fill-a-specific-number-of-rows/m-p/778561#M247836</link>
      <description>Honestly if I were doing this in R I would be do something completely different for the task at hand because R has better capabilities for data structures. But if I just needed to do something like this, I would use a for loop. I know there are DO loops in SAS but I would take advantage of easy indexing in R: I could say table_name[2, 4] and it would give me the contents of the cell in the second row and fourth column. So in a loop I could do something like table_name[i, 3] = .... to add to the third column.&lt;BR /&gt;&lt;BR /&gt;As far as I'm aware there's no equivalency of that in SAS.</description>
      <pubDate>Thu, 04 Nov 2021 17:45:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Repeat-rows-to-fill-to-fill-a-specific-number-of-rows/m-p/778561#M247836</guid>
      <dc:creator>Transcendental</dc:creator>
      <dc:date>2021-11-04T17:45:35Z</dc:date>
    </item>
    <item>
      <title>Re: Repeat rows to fill to fill a specific number of rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Repeat-rows-to-fill-to-fill-a-specific-number-of-rows/m-p/778563#M247838</link>
      <description>&lt;P&gt;What is the source of data you want use?&lt;/P&gt;
&lt;P&gt;What is the source of the number of rows you want to create?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why the heck would you ever want to do this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyway it seems simple enough.&amp;nbsp; Let's create the source dataset.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input id $ @@;
cards;
A B C D E
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now let's keep re-reading it until we get to 12 observations.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  if _n_&amp;gt;12 then stop;
  point=1+mod(_n_-1,nobs);
  set have point=point nobs=nobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;PRE&gt;Obs    id

  1    A
  2    B
  3    C
  4    D
  5    E
  6    A
  7    B
  8    C
  9    D
 10    E
 11    A
 12    B
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Nov 2021 17:55:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Repeat-rows-to-fill-to-fill-a-specific-number-of-rows/m-p/778563#M247838</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-11-04T17:55:03Z</dc:date>
    </item>
    <item>
      <title>Re: Repeat rows to fill to fill a specific number of rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Repeat-rows-to-fill-to-fill-a-specific-number-of-rows/m-p/778565#M247840</link>
      <description>&lt;P&gt;Do you just want to generate that dataset from a program?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  length index 8 id $1 ;
  index=0;
  do until(index&amp;gt;=12);
    do id='A','B','C','D','E';
       index+1;
       output;
       if index &amp;gt;=12 then leave;
    end;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Nov 2021 17:59:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Repeat-rows-to-fill-to-fill-a-specific-number-of-rows/m-p/778565#M247840</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-11-04T17:59:55Z</dc:date>
    </item>
    <item>
      <title>Re: Repeat rows to fill to fill a specific number of rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Repeat-rows-to-fill-to-fill-a-specific-number-of-rows/m-p/778567#M247842</link>
      <description>I program in both languages as well, so seeing your solution in R would help me to point out the similar or relevant constructs in SAS but your question is pretty straightforward so someone can definitely help you answer it anyways.</description>
      <pubDate>Thu, 04 Nov 2021 18:01:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Repeat-rows-to-fill-to-fill-a-specific-number-of-rows/m-p/778567#M247842</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-11-04T18:01:49Z</dc:date>
    </item>
    <item>
      <title>Re: Repeat rows to fill to fill a specific number of rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Repeat-rows-to-fill-to-fill-a-specific-number-of-rows/m-p/778575#M247847</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/405485"&gt;@Transcendental&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Honestly if I were doing this in R I would be do &lt;FONT color="#FF0000"&gt;something completely different for the task at hand&lt;/FONT&gt; because R has better capabilities for data structures. But if I just needed to do something like this, I would use a for loop. I know there are DO loops in SAS but I would take advantage of easy indexing in R: I could say table_name[2, 4] and it would give me the contents of the cell in the second row and fourth column. So in a loop I could do something like table_name[i, 3] = .... to add to the third column.&lt;BR /&gt;&lt;BR /&gt;As far as I'm aware there's no equivalency of that in SAS.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Are you are asking the wrong question?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _12;
   if _n_ gt 12 then stop;
   set have have have;
   run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Nov 2021 18:28:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Repeat-rows-to-fill-to-fill-a-specific-number-of-rows/m-p/778575#M247847</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2021-11-04T18:28:17Z</dc:date>
    </item>
    <item>
      <title>Re: Repeat rows to fill to fill a specific number of rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Repeat-rows-to-fill-to-fill-a-specific-number-of-rows/m-p/778582#M247849</link>
      <description>Essentially, I'm creating a snake draft, but there's going to be roughly 50+ users (via usernames in one table), changing weekly. And the source of the number of rows (players that can be chosen, in a different table) are also changing weekly.&lt;BR /&gt;&lt;BR /&gt;This is very helpful! Thank you!</description>
      <pubDate>Thu, 04 Nov 2021 19:29:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Repeat-rows-to-fill-to-fill-a-specific-number-of-rows/m-p/778582#M247849</guid>
      <dc:creator>Transcendental</dc:creator>
      <dc:date>2021-11-04T19:29:23Z</dc:date>
    </item>
    <item>
      <title>Re: Repeat rows to fill to fill a specific number of rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Repeat-rows-to-fill-to-fill-a-specific-number-of-rows/m-p/778591#M247854</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/405485"&gt;@Transcendental&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Essentially, I'm creating a snake draft, but there's going to be roughly 50+ users (via usernames in one table), changing weekly. And the source of the number of rows (players that can be chosen, in a different table) are also changing weekly.&lt;BR /&gt;&lt;BR /&gt;This is very helpful! Thank you!&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That says TWO tables (at least) are involved. Which is quite different conceptually than what you show in the original question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So why do you ask about adding a fixed number of rows? Perhaps the data with a proper join between the two tables takes care of things.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or look at Proc IML&lt;/P&gt;</description>
      <pubDate>Thu, 04 Nov 2021 20:12:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Repeat-rows-to-fill-to-fill-a-specific-number-of-rows/m-p/778591#M247854</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-11-04T20:12:35Z</dc:date>
    </item>
    <item>
      <title>Re: Repeat rows to fill to fill a specific number of rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Repeat-rows-to-fill-to-fill-a-specific-number-of-rows/m-p/778599#M247858</link>
      <description>Because I only needed help with one aspect of an overarching goal. I didn't want to overcomplicate my question by adding in every single detail when I can extrapolate to my larger goal.</description>
      <pubDate>Thu, 04 Nov 2021 20:58:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Repeat-rows-to-fill-to-fill-a-specific-number-of-rows/m-p/778599#M247858</guid>
      <dc:creator>Transcendental</dc:creator>
      <dc:date>2021-11-04T20:58:09Z</dc:date>
    </item>
    <item>
      <title>Re: Repeat rows to fill to fill a specific number of rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Repeat-rows-to-fill-to-fill-a-specific-number-of-rows/m-p/778603#M247860</link>
      <description>You can and will very likely get to your end solution but you'll hate SAS at the end because you'll be using it inefficiently.</description>
      <pubDate>Thu, 04 Nov 2021 21:07:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Repeat-rows-to-fill-to-fill-a-specific-number-of-rows/m-p/778603#M247860</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-11-04T21:07:52Z</dc:date>
    </item>
    <item>
      <title>Re: Repeat rows to fill to fill a specific number of rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Repeat-rows-to-fill-to-fill-a-specific-number-of-rows/m-p/778705#M247906</link>
      <description>&lt;P&gt;As &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt; said, you should consider SAS/IML . It is very like R language.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input id $ @@;
cards;
A B C D E
;

proc iml;
use have;
read all var _all_ into x[c=vname];
close;
want=shape(x,12,ncol(x));
print want[c=vname l=''];
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Nov 2021 11:52:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Repeat-rows-to-fill-to-fill-a-specific-number-of-rows/m-p/778705#M247906</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-11-05T11:52:01Z</dc:date>
    </item>
  </channel>
</rss>

