<?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: faster ways to calculate? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/faster-ways-to-calculate/m-p/549728#M152587</link>
    <description>&lt;P&gt;Thanks for your response, &lt;SPAN class="login-bold"&gt;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954" target="_self"&gt;Astounding&lt;/A&gt;.&amp;nbsp;&lt;/SPAN&gt;I just need mu.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Apr 2019 17:35:34 GMT</pubDate>
    <dc:creator>Jenc</dc:creator>
    <dc:date>2019-04-09T17:35:34Z</dc:date>
    <item>
      <title>faster ways to calculate?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/faster-ways-to-calculate/m-p/549713#M152575</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;I have two data sets (i.e., Temp1 and Temp2). Temp1 has one variable x with 20000 observations, and Temp2 contains four variables y1, y2, z1 and z2 with 60000 observations.&lt;BR /&gt;I used the following codes to obtain variable mu, but it took a lot of time to get the result with the large sample sizes. Is there a way that can have SAS run faster? Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc sql noprint; select x into :x1 - :x20000 from temp1;quit;

data temp3;
set temp2;
%do i= 1 %to 20000;
T&amp;amp;i.= (constant('E')**(y1*(&amp;amp;&amp;amp;x&amp;amp;i.-z1)) - constant('E')**(y2*(&amp;amp;&amp;amp;x&amp;amp;i.-z2)))**2
%end;
mu = mean (of T1-T20000));&amp;nbsp;
run;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Apr 2019 17:02:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/faster-ways-to-calculate/m-p/549713#M152575</guid>
      <dc:creator>Jenc</dc:creator>
      <dc:date>2019-04-09T17:02:02Z</dc:date>
    </item>
    <item>
      <title>Re: faster ways to calculate?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/faster-ways-to-calculate/m-p/549719#M152581</link>
      <description>When all is said and done, do you need T1-T20000, or do you just need mu?</description>
      <pubDate>Tue, 09 Apr 2019 17:21:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/faster-ways-to-calculate/m-p/549719#M152581</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-04-09T17:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: faster ways to calculate?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/faster-ways-to-calculate/m-p/549728#M152587</link>
      <description>&lt;P&gt;Thanks for your response, &lt;SPAN class="login-bold"&gt;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954" target="_self"&gt;Astounding&lt;/A&gt;.&amp;nbsp;&lt;/SPAN&gt;I just need mu.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2019 17:35:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/faster-ways-to-calculate/m-p/549728#M152587</guid>
      <dc:creator>Jenc</dc:creator>
      <dc:date>2019-04-09T17:35:34Z</dc:date>
    </item>
    <item>
      <title>Re: faster ways to calculate?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/faster-ways-to-calculate/m-p/549731#M152589</link>
      <description>&lt;P&gt;Then I would get rid of the macro language and the abundant variables. Given that you have no missing values, start with:&lt;BR /&gt;&lt;BR /&gt;data want;&lt;BR /&gt;array xval [20000] _temporary_;&lt;BR /&gt;if _n_=1 then do k=1 to 20000;&lt;BR /&gt;set temp1;&lt;BR /&gt;Xval[k]=x;&lt;BR /&gt;end;&lt;BR /&gt;&lt;BR /&gt;That makes all 20,000 values of x available. Next, accumulate the numerator:&lt;BR /&gt;&lt;BR /&gt;set temp2;&lt;/P&gt;
&lt;P&gt;mu = 0;&lt;BR /&gt;do k=1 to 20000;&lt;BR /&gt;mu + same formula, using xval[k] not &amp;amp;&amp;amp;x&amp;amp;I;&lt;BR /&gt;end;&lt;BR /&gt;mu = mu/ 20000;&lt;/P&gt;
&lt;P&gt;drop x k;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2019 18:55:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/faster-ways-to-calculate/m-p/549731#M152589</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-04-09T18:55:54Z</dc:date>
    </item>
    <item>
      <title>Re: faster ways to calculate?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/faster-ways-to-calculate/m-p/549776#M152601</link>
      <description>&lt;P&gt;It did get much faster. Thanks so much for your help!!!&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2019 19:17:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/faster-ways-to-calculate/m-p/549776#M152601</guid>
      <dc:creator>Jenc</dc:creator>
      <dc:date>2019-04-09T19:17:14Z</dc:date>
    </item>
  </channel>
</rss>

