<?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: nested do loop with iml in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/nested-do-loop-with-iml/m-p/276660#M2852</link>
    <description>&lt;P&gt;I am not sure what you mean by the line of code that starts doit[i,j]=...&amp;nbsp;&amp;nbsp; however the code below that can be made to work.&amp;nbsp; The problems are:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;the do loops allow i to be equal to j - you probably do not want the zeros that will result from this.&lt;/LI&gt;
&lt;LI&gt;either group_mean&amp;nbsp;or groupmean is a typo.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;If you still cannot make it work, then please show us the messages that you are getting in the log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In general it is a bad habit&amp;nbsp;to grow matrices by&amp;nbsp;concatenation inside a loop - this is very inefficient in terms of&amp;nbsp;memory use.&amp;nbsp; For a=3 you will probably not notice, but similar code&amp;nbsp;with a=1000&amp;nbsp;would grind to a halt.&lt;/P&gt;</description>
    <pubDate>Sat, 11 Jun 2016 07:39:09 GMT</pubDate>
    <dc:creator>IanWakeling</dc:creator>
    <dc:date>2016-06-11T07:39:09Z</dc:date>
    <item>
      <title>nested do loop with iml</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/nested-do-loop-with-iml/m-p/276614#M2849</link>
      <description>&lt;P&gt;I need to write a funtion or module that creates a row vector called doit of dimmesion k(k-1)/2 that contains the pairwise differences between the k leverl means. I need nested do loops&lt;/P&gt;&lt;P&gt;doit[i,j]= Yi0 hat- Yjo hat&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;below is my code&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;a=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;3&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&amp;nbsp;&amp;nbsp; # k level&amp;nbsp; (maybe I can replace it with ncol (mymatrix)?)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;doit={};&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000" face="Courier New" size="2"&gt;&lt;FONT color="#ff0000" face="Courier New" size="2"&gt;&lt;FONT color="#ff0000" face="Courier New" size="2"&gt;do&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; i= &lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; to a;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000" face="Courier New" size="2"&gt;&lt;FONT color="#ff0000" face="Courier New" size="2"&gt;&lt;FONT color="#ff0000" face="Courier New" size="2"&gt;do&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; j = i&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; to a;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;dime&amp;nbsp;= group_mean[i]-groupmean[j];&lt;/P&gt;&lt;P&gt;doit=&amp;nbsp;doit||dime;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;end&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;end&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;but it does not work. ANy other suggestions to make it work? Any other solutions&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2016 20:57:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/nested-do-loop-with-iml/m-p/276614#M2849</guid>
      <dc:creator>Bal23</dc:creator>
      <dc:date>2016-06-10T20:57:36Z</dc:date>
    </item>
    <item>
      <title>Re: nested do loop with iml</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/nested-do-loop-with-iml/m-p/276660#M2852</link>
      <description>&lt;P&gt;I am not sure what you mean by the line of code that starts doit[i,j]=...&amp;nbsp;&amp;nbsp; however the code below that can be made to work.&amp;nbsp; The problems are:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;the do loops allow i to be equal to j - you probably do not want the zeros that will result from this.&lt;/LI&gt;
&lt;LI&gt;either group_mean&amp;nbsp;or groupmean is a typo.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;If you still cannot make it work, then please show us the messages that you are getting in the log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In general it is a bad habit&amp;nbsp;to grow matrices by&amp;nbsp;concatenation inside a loop - this is very inefficient in terms of&amp;nbsp;memory use.&amp;nbsp; For a=3 you will probably not notice, but similar code&amp;nbsp;with a=1000&amp;nbsp;would grind to a halt.&lt;/P&gt;</description>
      <pubDate>Sat, 11 Jun 2016 07:39:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/nested-do-loop-with-iml/m-p/276660#M2852</guid>
      <dc:creator>IanWakeling</dc:creator>
      <dc:date>2016-06-11T07:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: nested do loop with iml</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/nested-do-loop-with-iml/m-p/276679#M2853</link>
      <description>&lt;P&gt;For a more on Ian's comment about concatenating inside a DO loop (as well as an alternative approach), see the article &lt;A href="http://blogs.sas.com/content/iml/2015/02/16/friends-dont-let-friends-concatenate-results-inside-a-loop.html" target="_self"&gt;"Friends don't let friends concatenate results inside a loop."&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Jun 2016 11:56:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/nested-do-loop-with-iml/m-p/276679#M2853</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-06-11T11:56:07Z</dc:date>
    </item>
  </channel>
</rss>

