<?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: Optimize the algorithm by using IML in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Optimize-the-algorithm-by-using-IML/m-p/691497#M210476</link>
    <description>&lt;P&gt;Calling&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 14 Oct 2020 10:33:36 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2020-10-14T10:33:36Z</dc:date>
    <item>
      <title>Optimize the algorithm by using IML</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Optimize-the-algorithm-by-using-IML/m-p/691457#M210462</link>
      <description>&lt;P&gt;My Dears,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With enlightenment from paper&amp;nbsp;&lt;A href="https://support.sas.com/resources/papers/proceedings/proceedings/forum2007/188-2007.pdf，" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings/proceedings/forum2007/188-2007.pdf，&lt;/A&gt;&amp;nbsp;I am worndering &lt;STRONG&gt;if there is a way&amp;nbsp; to make the code running more efficient (in terms of the time it used to get the dataset)&lt;/STRONG&gt;, like convert to IML, using array?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro SIMON(usern, p0, p1, alpha, beta );&lt;BR /&gt;data stage1; &lt;BR /&gt;do n1=2 to &amp;amp;usern-1;&lt;BR /&gt;do r1=0 to n1 while (r1&amp;lt;n1);&lt;BR /&gt;term1_p0 = cdf('BINOMIAL', r1, &amp;amp;p0, n1);&lt;BR /&gt;term1_p1 = cdf('BINOMIAL', r1, &amp;amp;p1, n1);&lt;BR /&gt;if term1_p1=&amp;lt;&amp;amp;beta then output; /*remove solution sets that do not meet the beta requirement*/&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;data stage12;&lt;BR /&gt;set stage1; &lt;BR /&gt;do n=n1+1 to &amp;amp;usern;&lt;BR /&gt;do r=r1+1 to n while (r1&amp;lt;r&amp;lt;n);&lt;BR /&gt;term2_p0=0; *initialize the summation terms for alpha &amp;amp; beta calculations;&lt;BR /&gt;term2_p1=0; &lt;BR /&gt;do x=r1+1 to min(r, n1);&lt;BR /&gt;dum0=pdf('BINOMIAL', x, &amp;amp;p0, n1)*cdf('BINOMIAL', r-x, &amp;amp;p0, n-n1);&lt;BR /&gt;dum1=pdf('BINOMIAL', x, &amp;amp;p1, n1)*cdf('BINOMIAL', r-x, &amp;amp;p1, n-n1);&lt;BR /&gt;term2_p0= term2_p0+dum0;*recursive formulae used for summation terms; &lt;BR /&gt;term2_p1= term2_p1+dum1;&lt;BR /&gt;&lt;BR /&gt;if 1-(term1_p0+term2_p0)=&amp;lt;&amp;amp;alpha and (term1_p1+term2_p1)=&amp;lt;&amp;amp;beta then output; end; &lt;BR /&gt;end;&lt;BR /&gt;end; &lt;BR /&gt;run;&lt;BR /&gt;%mend; &lt;BR /&gt;%SIMON(alpha=0.05, beta=0.2, p0=0.05, p1=0.25, usern=130)/*Though the paper recommended not exceed 120, there is still the case that to check if there is more optimal one beyond 120*/&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;IML is strange to me, therefore I seek your help to optimze the above code. Thank you in advance.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Oct 2020 05:46:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Optimize-the-algorithm-by-using-IML/m-p/691457#M210462</guid>
      <dc:creator>Jack2012</dc:creator>
      <dc:date>2020-10-14T05:46:08Z</dc:date>
    </item>
    <item>
      <title>Re: Optimize the algorithm by using IML</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Optimize-the-algorithm-by-using-IML/m-p/691459#M210464</link>
      <description>&lt;P&gt;If I am correct, loop in PROC SQL is not easy or maybe impossible.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Oct 2020 05:47:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Optimize-the-algorithm-by-using-IML/m-p/691459#M210464</guid>
      <dc:creator>Jack2012</dc:creator>
      <dc:date>2020-10-14T05:47:48Z</dc:date>
    </item>
    <item>
      <title>Re: Optimize the algorithm by using IML</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Optimize-the-algorithm-by-using-IML/m-p/691497#M210476</link>
      <description>&lt;P&gt;Calling&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Oct 2020 10:33:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Optimize-the-algorithm-by-using-IML/m-p/691497#M210476</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-10-14T10:33:36Z</dc:date>
    </item>
    <item>
      <title>Re: Optimize the algorithm by using IML</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Optimize-the-algorithm-by-using-IML/m-p/692359#M210909</link>
      <description>Thank you, Ksharp. &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;, could you give me some help? Thank you.</description>
      <pubDate>Sun, 18 Oct 2020 12:41:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Optimize-the-algorithm-by-using-IML/m-p/692359#M210909</guid>
      <dc:creator>Jack2012</dc:creator>
      <dc:date>2020-10-18T12:41:44Z</dc:date>
    </item>
    <item>
      <title>Re: Optimize the algorithm by using IML</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Optimize-the-algorithm-by-using-IML/m-p/692389#M210924</link>
      <description>&lt;P&gt;I want to be sure that I understand the situation and your request:&lt;/P&gt;
&lt;P&gt;1. You have copied the DATA step code from the paper. The program works and gives you the correct answer.&lt;/P&gt;
&lt;P&gt;2. Although the paper cautions not to use the program for USERN &amp;gt; 120, you are using it for USERN=130, so you want to find a faster way to generate the same results.&lt;/P&gt;
&lt;P&gt;3. You think maybe converting the program to IML will make it run faster. Since you have little or no experience with IML, you are looking for someone to convert it into IML for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suspect the problem is that the program is generating hundreds of millions of candidates and then writing 38.5 million records that satisfy the criterion. IMHO, converting the same algorithm into IML won't make it go substantially faster or make the final data set smaller.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Oct 2020 19:21:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Optimize-the-algorithm-by-using-IML/m-p/692389#M210924</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2020-10-18T19:21:22Z</dc:date>
    </item>
    <item>
      <title>Re: Optimize the algorithm by using IML</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Optimize-the-algorithm-by-using-IML/m-p/692454#M210968</link>
      <description>Rick, thank you. Yes, your understanding is absolutely correct. &lt;BR /&gt;&lt;BR /&gt;OK, then I will not try anymore. &lt;BR /&gt;Thank you, and Ksharp.</description>
      <pubDate>Mon, 19 Oct 2020 09:00:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Optimize-the-algorithm-by-using-IML/m-p/692454#M210968</guid>
      <dc:creator>Jack2012</dc:creator>
      <dc:date>2020-10-19T09:00:03Z</dc:date>
    </item>
  </channel>
</rss>

