<?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: Changing data dimensions in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Changing-data-dimensions/m-p/389291#M277497</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/80356"&gt;@DoumbiaS&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Here another coding variant using arrays.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have(drop=_:);
  array _vars {7,3} 8;
  infile datalines dlm=' ' truncover;
  input _vars[*];
  array a {7} 8;

  do _d2=1 to dim(_vars,2);
    do _d1=1 to dim(_vars,1);
      a[_d1]=_vars[_d1,_d2];
    end;
    output;
  end;

  datalines;
.101 .201 .3 .4 .5 .6 .7 .8 .9 .10 .11 .12 .13 .14 .15 .16 .17 .18 .19 .20 .21
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 19 Aug 2017 02:27:37 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2017-08-19T02:27:37Z</dc:date>
    <item>
      <title>Changing data dimensions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-data-dimensions/m-p/389132#M277490</link>
      <description>&lt;P&gt;Hi to all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using only array statements or a call execute statement, is it possible to do this :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input a1-a10;
cards;
.101 .201 .3 .4 .5 .6 .7 .8 .9 .10 .11 .12 .13 .14 .15 .16 .17 .18 .19 .20 .21
;
data want;
input a1-a7;
cards;
.101 .4    .7   .10  .13   .16  .19
.201 .5    .8   .11  .14   .17  .20
.3   .6    .9   .12  .15   .18  .21
;run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Fri, 18 Aug 2017 16:32:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-data-dimensions/m-p/389132#M277490</guid>
      <dc:creator>DoumbiaS</dc:creator>
      <dc:date>2017-08-18T16:32:41Z</dc:date>
    </item>
    <item>
      <title>Re: DataM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-data-dimensions/m-p/389133#M277491</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/80356"&gt;@DoumbiaS&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi to all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using only array statements or a call execute statement, is it possible to do this :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Why is there a need to place restrictions on what elements of SAS can be used? Is this a homework problem?&lt;/P&gt;</description>
      <pubDate>Fri, 18 Aug 2017 15:46:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-data-dimensions/m-p/389133#M277491</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-08-18T15:46:33Z</dc:date>
    </item>
    <item>
      <title>Re: DataM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-data-dimensions/m-p/389138#M277492</link>
      <description>&lt;P&gt;I could use a proc sql but I think that It will use &lt;SPAN&gt;Lots of resources with large data. But I welcome anything. Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Aug 2017 15:53:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-data-dimensions/m-p/389138#M277492</guid>
      <dc:creator>DoumbiaS</dc:creator>
      <dc:date>2017-08-18T15:53:30Z</dc:date>
    </item>
    <item>
      <title>Re: DataM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-data-dimensions/m-p/389140#M277493</link>
      <description>&lt;P&gt;Your "data have" statement is wrong, it doesn't read the complete data. &amp;nbsp;Is there some sort of logic behind the request, as taking a bunch of variables and outputting a gourp to each line doesn't make any sense without some sort of identifiers. &amp;nbsp;Providing a good example of the data will likely solve this. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit, I mean from this random logic, this would work:&lt;/P&gt;
&lt;PRE&gt;data want (keep=col:);
  set have (rename=(a1=col1 a4=col2 a7=col3 a10=col4 a12=col5))
        have (rename=(a2=col1...))
        have (rename=(a3=col1...));
run;&lt;/PRE&gt;
&lt;P&gt;Note you might need a keep on each of those datasets, haven't tried the code, just showing that setting the data three times with renames would work.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Aug 2017 16:10:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-data-dimensions/m-p/389140#M277493</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-08-18T16:10:06Z</dc:date>
    </item>
    <item>
      <title>Re: DataM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-data-dimensions/m-p/389144#M277494</link>
      <description>&lt;P&gt;Here is another way using arrays:&lt;/P&gt;
&lt;PRE&gt;data have;
  input a1-a21;
  cards;
.101 .201 .3 .4 .5 .6 .7 .8 .9 .10 .11 .12 .13 .14 .15 .16 .17 .18 .19 .20 .21
;

data want (drop=_:);
  set have (rename=(a1-a21=_a1-_a21));
  array all(*) _a1-_a21;
  array part(7) a1-a7;
  do _i=1 to 3;
    _k=0;
    do _j=_i to dim(all) by 3;
      _k+1;
      part(_k)=all(_j);
    end;
    output;
  end;
run;&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Aug 2017 16:24:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-data-dimensions/m-p/389144#M277494</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-08-18T16:24:48Z</dc:date>
    </item>
    <item>
      <title>Re: DataM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-data-dimensions/m-p/389147#M277495</link>
      <description>&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; have;&lt;/P&gt;&lt;P&gt;input a1-a21;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;.101 .201 .3 .4 .5 .6 .7 .8 .9 .10 .11 .12 .13 .14 .15 .16 .17 .18 .19 .20 .21&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;array ar(*) a:;&lt;/P&gt;&lt;P&gt;do _n_=&lt;STRONG&gt;1&lt;/STRONG&gt; to dim(ar);&lt;/P&gt;&lt;P&gt;b=ar(_n_);&lt;/P&gt;&lt;P&gt;index+&lt;STRONG&gt;1&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;if mod(index,&lt;STRONG&gt;3&lt;/STRONG&gt;)=&lt;STRONG&gt;0&lt;/STRONG&gt; then index=&lt;STRONG&gt;0&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;drop a:;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;sort&lt;/STRONG&gt; data= want out=want1;&lt;/P&gt;&lt;P&gt;by index;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;transpose&lt;/STRONG&gt; data=want1 out=want2(drop=index b _NAME_) ;&lt;/P&gt;&lt;P&gt;by index;&lt;/P&gt;&lt;P&gt;var b;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Aug 2017 16:31:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-data-dimensions/m-p/389147#M277495</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2017-08-18T16:31:00Z</dc:date>
    </item>
    <item>
      <title>Re: Changing data dimensions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-data-dimensions/m-p/389235#M277496</link>
      <description>Is that a pattern - every 4th cell belongs to the same obs? And these are all numeric?&lt;BR /&gt;I like the idea of reducing the process - into a single pass (well I/O is the biggest performance blocker)&lt;BR /&gt;Try proc iml&lt;BR /&gt;</description>
      <pubDate>Fri, 18 Aug 2017 21:30:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-data-dimensions/m-p/389235#M277496</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2017-08-18T21:30:50Z</dc:date>
    </item>
    <item>
      <title>Re: Changing data dimensions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-data-dimensions/m-p/389291#M277497</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/80356"&gt;@DoumbiaS&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Here another coding variant using arrays.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have(drop=_:);
  array _vars {7,3} 8;
  infile datalines dlm=' ' truncover;
  input _vars[*];
  array a {7} 8;

  do _d2=1 to dim(_vars,2);
    do _d1=1 to dim(_vars,1);
      a[_d1]=_vars[_d1,_d2];
    end;
    output;
  end;

  datalines;
.101 .201 .3 .4 .5 .6 .7 .8 .9 .10 .11 .12 .13 .14 .15 .16 .17 .18 .19 .20 .21
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 19 Aug 2017 02:27:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-data-dimensions/m-p/389291#M277497</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-08-19T02:27:37Z</dc:date>
    </item>
    <item>
      <title>Re: Changing data dimensions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-data-dimensions/m-p/389303#M277498</link>
      <description>&lt;P&gt;So sorry for my long absence.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Of course it was a copy - paste error about a10 instead of a21.&lt;/P&gt;&lt;P&gt;Such I use large dataset with great large number of variables, optimize is efficient.&lt;/P&gt;&lt;P&gt;Thanks to all for responses.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Sat, 19 Aug 2017 08:45:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-data-dimensions/m-p/389303#M277498</guid>
      <dc:creator>DoumbiaS</dc:creator>
      <dc:date>2017-08-19T08:45:45Z</dc:date>
    </item>
  </channel>
</rss>

