<?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: Proc IML do loop vectorization SAS 9.4 in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Proc-IML-do-loop-vectorization-SAS-9-4/m-p/554307#M4656</link>
    <description>&lt;P&gt;Yes, you can pass a vector to the SUBMIT statement. You will get a space-separated list of values. You'll have to make your macro more complicated to handle this situation, but here's the idea:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
ru = {3, 7, 10, 2};
/* old method */
do k=1 to nrow(ru);
   x=ru[k,];
   submit x;
      %put &amp;amp;x;
   endsubmit;
end;

/* new method */
submit ru;
   %put &amp;amp;ru;
endsubmit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 26 Apr 2019 14:58:53 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2019-04-26T14:58:53Z</dc:date>
    <item>
      <title>Proc IML do loop vectorization SAS 9.4</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Proc-IML-do-loop-vectorization-SAS-9-4/m-p/554297#M4655</link>
      <description>&lt;P&gt;I'm working with a nested loop using proc iml to replicate exisiting R code. I have a solution but it's computationally very slow. Below is the inner-most loop that I am wondering if I can vectorize for increased performance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;do k=1 to nrow(ru);
y={};
x=ru[k,];
submit x;

%ret(&amp;amp;x, data);
endsubmit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This part of the code is looping through the elements of the ru vector and passing them as a macro variable into the ret function.&amp;nbsp; The ret function produces datasets which end up producing subsequent ru vectors and the process is iterated many times.&amp;nbsp; I'm pretty sure this is where the bottleneck in the code is coming from.&amp;nbsp; Is it possible for me to pass the vector of ru elements without looping through each element?&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2019 14:43:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Proc-IML-do-loop-vectorization-SAS-9-4/m-p/554297#M4655</guid>
      <dc:creator>dsriggs11</dc:creator>
      <dc:date>2019-04-26T14:43:42Z</dc:date>
    </item>
    <item>
      <title>Re: Proc IML do loop vectorization SAS 9.4</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Proc-IML-do-loop-vectorization-SAS-9-4/m-p/554307#M4656</link>
      <description>&lt;P&gt;Yes, you can pass a vector to the SUBMIT statement. You will get a space-separated list of values. You'll have to make your macro more complicated to handle this situation, but here's the idea:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
ru = {3, 7, 10, 2};
/* old method */
do k=1 to nrow(ru);
   x=ru[k,];
   submit x;
      %put &amp;amp;x;
   endsubmit;
end;

/* new method */
submit ru;
   %put &amp;amp;ru;
endsubmit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Apr 2019 14:58:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Proc-IML-do-loop-vectorization-SAS-9-4/m-p/554307#M4656</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2019-04-26T14:58:53Z</dc:date>
    </item>
    <item>
      <title>Re: Proc IML do loop vectorization SAS 9.4</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Proc-IML-do-loop-vectorization-SAS-9-4/m-p/554592#M4657</link>
      <description>&lt;P&gt;You could this function to transform SAS matrix into R dataframe. and do loop in R statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc iml;
a = {1 2 3, 4 . 6};
call ExportMatrixToR(a, "m");
submit / R;
print(m)
endsubmit;
&lt;/PRE&gt;</description>
      <pubDate>Sun, 28 Apr 2019 15:07:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Proc-IML-do-loop-vectorization-SAS-9-4/m-p/554592#M4657</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-04-28T15:07:11Z</dc:date>
    </item>
  </channel>
</rss>

