<?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: Array help in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Array-help/m-p/423557#M68131</link>
    <description>Any hint if I do it with Arrays as it has got many variables?</description>
    <pubDate>Tue, 26 Dec 2017 10:53:10 GMT</pubDate>
    <dc:creator>Ajeet1</dc:creator>
    <dc:date>2017-12-26T10:53:10Z</dc:date>
    <item>
      <title>Array help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Array-help/m-p/423551#M68127</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have below table :&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;Data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; Abc;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; x y z;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;datalines&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;2 3 1&lt;/P&gt;&lt;P&gt;3 2 1&lt;/P&gt;&lt;P&gt;1 2 3&lt;/P&gt;&lt;P&gt;2 2 2&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Problem :&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;I want my to multiply all the observation one by one for their respective columns. Hence my output would look like below :&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;X&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&amp;nbsp;Y&amp;nbsp; Z&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp; &amp;nbsp;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;3&lt;/FONT&gt;&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;STRONG&gt;6&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;6&lt;/FONT&gt;&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;STRONG&gt;6&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;12&lt;/FONT&gt;&lt;/STRONG&gt;&amp;nbsp; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;3&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;STRONG&gt;12&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;24&lt;/FONT&gt;&lt;/STRONG&gt;&amp;nbsp; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;6&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Dec 2017 09:55:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Array-help/m-p/423551#M68127</guid>
      <dc:creator>Ajeet1</dc:creator>
      <dc:date>2017-12-26T09:55:19Z</dc:date>
    </item>
    <item>
      <title>Re: Array help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Array-help/m-p/423552#M68128</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is one way.&amp;nbsp; If you have more than 3 variables, you can easily switch to use arrays.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Abc0;&lt;BR /&gt; input a b c; &lt;BR /&gt;datalines;&lt;BR /&gt;2 3 1&lt;BR /&gt;3 2 1&lt;BR /&gt;1 2 3&lt;BR /&gt;2 2 2&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;data abc(keep= x y z);&lt;BR /&gt; retain x y z 1;&lt;BR /&gt; do i = 1 to nobs;&lt;BR /&gt;   set abc0 point=i nobs=nobs;&lt;BR /&gt;   x = x * a; y = y * b; z = z * c;&lt;BR /&gt;   output;&lt;BR /&gt; end;&lt;BR /&gt; stop;&lt;BR /&gt; run;&lt;BR /&gt;&lt;BR /&gt;proc print; run;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Dec 2017 10:38:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Array-help/m-p/423552#M68128</guid>
      <dc:creator>WarrenKuhfeld</dc:creator>
      <dc:date>2017-12-26T10:38:08Z</dc:date>
    </item>
    <item>
      <title>Re: Array help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Array-help/m-p/423553#M68129</link>
      <description>&lt;P&gt;I don't understand why code I post recently has linefeed issues.&amp;nbsp; My code was perfect before I hit post.&amp;nbsp; Now all the line feeds are gone.&amp;nbsp; Trying again.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Abc0;
   input a b c; 
datalines;
2 3 1
3 2 1
1 2 3
2 2 2
;
data abc(keep= x y z);
   retain x y z 1;
   do i = 1 to nobs;
      set abc0 point=i nobs=nobs;
	  x = x * a; y = y * b; z = z * c;
	  output;
	  end;
   stop;
   run;

proc print; run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Dec 2017 10:39:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Array-help/m-p/423553#M68129</guid>
      <dc:creator>WarrenKuhfeld</dc:creator>
      <dc:date>2017-12-26T10:39:54Z</dc:date>
    </item>
    <item>
      <title>Re: Array help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Array-help/m-p/423556#M68130</link>
      <description>&lt;P&gt;Thank you! You are right I have many variables and trying to do it with array but it is not working for me.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Dec 2017 10:51:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Array-help/m-p/423556#M68130</guid>
      <dc:creator>Ajeet1</dc:creator>
      <dc:date>2017-12-26T10:51:18Z</dc:date>
    </item>
    <item>
      <title>Re: Array help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Array-help/m-p/423557#M68131</link>
      <description>Any hint if I do it with Arrays as it has got many variables?</description>
      <pubDate>Tue, 26 Dec 2017 10:53:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Array-help/m-p/423557#M68131</guid>
      <dc:creator>Ajeet1</dc:creator>
      <dc:date>2017-12-26T10:53:10Z</dc:date>
    </item>
    <item>
      <title>Re: Array help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Array-help/m-p/423561#M68132</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Abc0;
   input a b c; 
datalines;
2 3 1
3 2 1
1 2 3
2 2 2
;
data abc(keep= x y z);
   array a1[3] a b c;
   array a2[3] x y z;
   retain x y z 1;
   do i = 1 to nobs;
      set abc0 point=i nobs=nobs;
      do j = 1 to 3; a2[j] = a2[j] * a1[j]; end;
      output;
   end;
   stop;
run;

proc print; run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Dec 2017 11:01:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Array-help/m-p/423561#M68132</guid>
      <dc:creator>WarrenKuhfeld</dc:creator>
      <dc:date>2017-12-26T11:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: Array help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Array-help/m-p/423565#M68134</link>
      <description>&lt;P&gt;Hi Warren,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please help with the array with the same problem&lt;/P&gt;</description>
      <pubDate>Tue, 26 Dec 2017 11:39:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Array-help/m-p/423565#M68134</guid>
      <dc:creator>Ajeet1</dc:creator>
      <dc:date>2017-12-26T11:39:41Z</dc:date>
    </item>
    <item>
      <title>Re: Array help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Array-help/m-p/423587#M68135</link>
      <description>&lt;P&gt;If you have SAS/IML, could make it more simple.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Abc;
input x y z;
datalines;
2 3 1
3 2 1
1 2 3
2 2 2
;
run;
proc iml;
use abc;
read all var _all_ into x[c=vname];
close;
want=j(nrow(x),ncol(x),.);
do i=1 to ncol(x);
 want[,i]=cuprod(x[,i]);
end;

create want from want[c=vname];
append from want;
close want;

quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Dec 2017 14:24:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Array-help/m-p/423587#M68135</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-12-26T14:24:37Z</dc:date>
    </item>
  </channel>
</rss>

