<?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: How can I convert a table with one row to a table with multiple rows? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-convert-a-table-with-one-row-to-a-table-with-multiple/m-p/349542#M81082</link>
    <description>&lt;PRE&gt;data have;
  input var1-var4 @@;
  cards;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 12 Apr 2017 17:41:19 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2017-04-12T17:41:19Z</dc:date>
    <item>
      <title>How can I convert a table with one row to a table with multiple rows?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-convert-a-table-with-one-row-to-a-table-with-multiple/m-p/349531#M81075</link>
      <description>&lt;P&gt;Can I convert the data in a table with one row to a table with multiple rows? What are&amp;nbsp;their coding?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Original table:&lt;/P&gt;&lt;P&gt;1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table that I want:&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; &amp;nbsp;2 &amp;nbsp; 3 &amp;nbsp; 4&lt;/P&gt;&lt;P&gt;5 &amp;nbsp; &amp;nbsp;6 &amp;nbsp; 7 &amp;nbsp; 8&lt;/P&gt;&lt;P&gt;9 &amp;nbsp; 10 11 12&lt;/P&gt;&lt;P&gt;13 14 15 16&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/13702iD8ED73AC4DA91CE6/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="DSC_0834.JPG" title="DSC_0834.JPG" /&gt;</description>
      <pubDate>Wed, 12 Apr 2017 16:59:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-convert-a-table-with-one-row-to-a-table-with-multiple/m-p/349531#M81075</guid>
      <dc:creator>Jonathanzz</dc:creator>
      <dc:date>2017-04-12T16:59:59Z</dc:date>
    </item>
    <item>
      <title>Re: How can I convert a table with one row to a table with multiple rows?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-convert-a-table-with-one-row-to-a-table-with-multiple/m-p/349542#M81082</link>
      <description>&lt;PRE&gt;data have;
  input var1-var4 @@;
  cards;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2017 17:41:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-convert-a-table-with-one-row-to-a-table-with-multiple/m-p/349542#M81082</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-04-12T17:41:19Z</dc:date>
    </item>
    <item>
      <title>Re: How can I convert a table with one row to a table with multiple rows?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-convert-a-table-with-one-row-to-a-table-with-multiple/m-p/349544#M81084</link>
      <description>&lt;P&gt;In this case an Array is probably your best bet, with an explicit OUTPUT statement. Here's a quick example with two loops.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;

array vals(*) val1-val16;
array new(*) new1-new4;

do i=1 to 4;

    do j=1 to 4;
         new(j) = vals(j*i);
    end;

output;

end;
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138855"&gt;@Jonathanzz&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Can I convert the data in a table with one row to a table with multiple rows? What are&amp;nbsp;their coding?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Original table:&lt;/P&gt;
&lt;P&gt;1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Table that I want:&lt;/P&gt;
&lt;P&gt;1 &amp;nbsp; &amp;nbsp;2 &amp;nbsp; 3 &amp;nbsp; 4&lt;/P&gt;
&lt;P&gt;5 &amp;nbsp; &amp;nbsp;6 &amp;nbsp; 7 &amp;nbsp; 8&lt;/P&gt;
&lt;P&gt;9 &amp;nbsp; 10 11 12&lt;/P&gt;
&lt;P&gt;13 14 15 16&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2017 17:45:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-convert-a-table-with-one-row-to-a-table-with-multiple/m-p/349544#M81084</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-04-12T17:45:16Z</dc:date>
    </item>
    <item>
      <title>Re: How can I convert a table with one row to a table with multiple rows?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-convert-a-table-with-one-row-to-a-table-with-multiple/m-p/349754#M81209</link>
      <description>&lt;P&gt;It is very easy for IML code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input var1-var4 @@;
  cards;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
;

proc iml;
use have;
read all var _all_ into x;
close;

want=shape(x,0,4);

create want from want;
append from want;
close;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Apr 2017 13:13:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-convert-a-table-with-one-row-to-a-table-with-multiple/m-p/349754#M81209</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-04-13T13:13:20Z</dc:date>
    </item>
    <item>
      <title>Re: How can I convert a table with one row to a table with multiple rows?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-convert-a-table-with-one-row-to-a-table-with-multiple/m-p/349809#M81236</link>
      <description>Thanks a lot!</description>
      <pubDate>Thu, 13 Apr 2017 17:07:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-convert-a-table-with-one-row-to-a-table-with-multiple/m-p/349809#M81236</guid>
      <dc:creator>Jonathanzz</dc:creator>
      <dc:date>2017-04-13T17:07:06Z</dc:date>
    </item>
    <item>
      <title>Re: How can I convert a table with one row to a table with multiple rows?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-convert-a-table-with-one-row-to-a-table-with-multiple/m-p/349924#M81290</link>
      <description>&lt;P&gt;I guess that one way for this approach would be:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want (keep = new1-new4);
set have;
array vals(*) var1-var16;
array new(*) new1-new4;

do j = 1 to floor(dim(vals)/4);
  do i = 1 to 4;
    new(i) = vals((j-1)*4 + i);
  end;
  output;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Apr 2017 00:52:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-convert-a-table-with-one-row-to-a-table-with-multiple/m-p/349924#M81290</guid>
      <dc:creator>ilikesas</dc:creator>
      <dc:date>2017-04-14T00:52:53Z</dc:date>
    </item>
    <item>
      <title>Re: How can I convert a table with one row to a table with multiple rows?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-convert-a-table-with-one-row-to-a-table-with-multiple/m-p/349966#M81303</link>
      <description>&lt;P&gt;I would probably&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. add&amp;nbsp;a new observation with values like 1,2,3,4,1,2,3,4,1,2,3,4,....&lt;/P&gt;&lt;P&gt;2. use Proc Transpose&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When your dataset is large, this can be super efficiant by avoiding loops.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2017 06:27:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-convert-a-table-with-one-row-to-a-table-with-multiple/m-p/349966#M81303</guid>
      <dc:creator>CiCi</dc:creator>
      <dc:date>2017-04-14T06:27:14Z</dc:date>
    </item>
  </channel>
</rss>

