<?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: Code performance in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Code-performance/m-p/761996#M241204</link>
    <description>I try to excute in TD</description>
    <pubDate>Tue, 17 Aug 2021 08:46:38 GMT</pubDate>
    <dc:creator>sathya66</dc:creator>
    <dc:date>2021-08-17T08:46:38Z</dc:date>
    <item>
      <title>Code performance</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-performance/m-p/761838#M241133</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;below code works fine but take more time to execute. Is there a way we can impove the perofrmance .&amp;nbsp;&lt;/P&gt;
&lt;P&gt;problem is with dates below.&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt; d.date_drd BETWEEN a.tr_pro_date AND a.tr_pro_date+(6*30.5)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;format for the columns are date9. (16AUG2018).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;test1 and test2 are Teradata databases.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql; 
create table work.auths2
as select 
a.*
FROM auths AS a 
LEFT JOIN test1.provisions b
ON a.id = b.id
AND b.period = a.month

LEFT JOIN Test2.account AS d
ON a.id=d.id
&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;AND d.date_drd BETWEEN a.tr_pro_date AND a.tr_pro_date+(6*30.5)&lt;/STRONG&gt;&lt;/FONT&gt;

LEFT JOIN test1.provisions f
ON a.id = f.id
AND a.AYPR = f.year_period; 
quit; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Aug 2021 15:27:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-performance/m-p/761838#M241133</guid>
      <dc:creator>sathya66</dc:creator>
      <dc:date>2021-08-16T15:27:12Z</dc:date>
    </item>
    <item>
      <title>Re: Code performance</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-performance/m-p/761845#M241136</link>
      <description>&lt;P&gt;Do you actually want 180 days or 6 months? They aren't the same thing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What makes you think that specific bit of code is your performance issue?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How many records in each of these sets? How long is "more time"?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Aug 2021 15:41:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-performance/m-p/761845#M241136</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-08-16T15:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: Code performance</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-performance/m-p/761854#M241139</link>
      <description>&lt;P&gt;Since you use two different patgs to the external DBMS, SAS cannot push processing there and needs to download all tables before doing all work locally.&lt;/P&gt;
&lt;P&gt;You will probably be better off pushing dataset auths2 to the DBMS and do the processing there.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Aug 2021 16:12:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-performance/m-p/761854#M241139</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-08-16T16:12:35Z</dc:date>
    </item>
    <item>
      <title>Re: Code performance</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-performance/m-p/761860#M241143</link>
      <description>180 days or 6 months also fine.&lt;BR /&gt;We were running this same code in our old enviroemnt  (9.3) and it was fine (run time ~30 mins ) .This is running now in 9.4 now but taking ~90  to120 mins.not sure whats wrong other jobs are running fine except this.&lt;BR /&gt;It has 10 million+ rocords but was okay in 9.3</description>
      <pubDate>Mon, 16 Aug 2021 16:18:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-performance/m-p/761860#M241143</guid>
      <dc:creator>sathya66</dc:creator>
      <dc:date>2021-08-16T16:18:12Z</dc:date>
    </item>
    <item>
      <title>Re: Code performance</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-performance/m-p/761862#M241144</link>
      <description>yeah I thought the same but We were running this same code since years. As I said above it was fine in 9.3.</description>
      <pubDate>Mon, 16 Aug 2021 16:19:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-performance/m-p/761862#M241144</guid>
      <dc:creator>sathya66</dc:creator>
      <dc:date>2021-08-16T16:19:47Z</dc:date>
    </item>
    <item>
      <title>Re: Code performance</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-performance/m-p/761892#M241160</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/93352"&gt;@sathya66&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;yeah I thought the same but We were running this same code since years. As I said above it was fine in 9.3.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Check what else has changed.&lt;/P&gt;
&lt;P&gt;Is SAS still running on the same server?&amp;nbsp; &amp;nbsp;If a different server is it "further" from the data?&amp;nbsp; Is the speed of the server the same? The memory? The disk drives? Is the load on the server the same?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are the libref's defined differently?&amp;nbsp; Was the old one using database specific engine? (ORACLE vs ODBC for example)&lt;/P&gt;
&lt;P&gt;Have the defaults for database access changed (block size perhaps?).&lt;/P&gt;</description>
      <pubDate>Mon, 16 Aug 2021 19:24:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-performance/m-p/761892#M241160</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-08-16T19:24:54Z</dc:date>
    </item>
    <item>
      <title>Re: Code performance</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-performance/m-p/761924#M241175</link>
      <description>Yes, everything has changed( server, speed and memory is higher than 9.3 ). &lt;BR /&gt;9.4 is more advanced than 9.3.&lt;BR /&gt;9.3 was on on-prime and 9.4 is on Cloud. 9.3 is a single machine install(meta,compute and mid is on the same server) but 9.4 is a multi install environment.&lt;BR /&gt;9.3 is a ODBC&lt;BR /&gt;9.4 is a SAS access.&lt;BR /&gt;Every job is working fine after migration except this.&lt;BR /&gt;I doubt on “between and “ condition and to do with date extraction. &lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;</description>
      <pubDate>Mon, 16 Aug 2021 20:50:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-performance/m-p/761924#M241175</guid>
      <dc:creator>sathya66</dc:creator>
      <dc:date>2021-08-16T20:50:53Z</dc:date>
    </item>
    <item>
      <title>Re: Code performance</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-performance/m-p/761927#M241176</link>
      <description>&lt;P&gt;If your cloud SAS and Teradata data sources are now physically much further apart than your previous installation it could be that is the only thing causing the slowness. For example if Teradata and SAS were in the same data centre but now they are not and are hundreds of kilometres apart could easily explain the performance you are seeing. So you have other large data extracts and their performance is fine?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Aug 2021 21:34:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-performance/m-p/761927#M241176</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-08-16T21:34:41Z</dc:date>
    </item>
    <item>
      <title>Re: Code performance</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-performance/m-p/761941#M241179</link>
      <description>&lt;P&gt;You can use&amp;nbsp; &amp;nbsp;&lt;FONT face="courier new,courier"&gt;options sastrace = ',,,db' ;&lt;/FONT&gt;&amp;nbsp; &amp;nbsp; to see what SQL is sent to the remote database.&lt;/P&gt;
&lt;P&gt;You could compare with the SQL used in 9.3.&lt;/P&gt;
&lt;P&gt;I suspect you'll see that no&amp;nbsp;&amp;nbsp;&lt;FONT face="courier new,courier"&gt;where&lt;/FONT&gt;&amp;nbsp; clause is passed to Teradata.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The way the query is coded, everything must match table AUTHS2, so the entire Teradata data is brought back to the SAS server. I suspect the speed or throughput are not as good in the new environments as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt;&amp;nbsp;said.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ideally, you'd upload the table of IDs (and date probably) from AUTHS2 to Teradata to do the subsetting there as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;said.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you cannot do this, another -more cumbersome- way is to make the IDs as part of the query. So you need to add&amp;nbsp;&amp;nbsp;&lt;FONT face="courier new,courier"&gt;where ID in (&lt;EM&gt;10 million values&lt;/EM&gt;)&amp;nbsp;&lt;/FONT&gt; to your code, supposing Teradata (and SAS) can deal with such a long query. If it does not, then you need to run successive queries with a limited number of IDs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Considering you currently match the Teradata data against your &lt;EM&gt;local &lt;/EM&gt;table, there is no other way: The data brought back and then it is matched &lt;EM&gt;locally&lt;/EM&gt;. So you have to find a way to subset the data remotely. I described these 2 ways: upload the required IDs as a table, or upload them as code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[Edit: I assume you want to match a small portion of the Teradata data. If you match most of it, there is little point uploading the IDs, and little you can do to optimise your code: It looks simple enough.]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Aug 2021 03:11:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-performance/m-p/761941#M241179</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-08-17T03:11:57Z</dc:date>
    </item>
    <item>
      <title>Re: Code performance</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-performance/m-p/761976#M241194</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/93352"&gt;@sathya66&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Yes, everything has changed( server, speed and memory is higher than 9.3 ). &lt;BR /&gt;9.4 is more advanced than 9.3.&lt;BR /&gt;&lt;FONT size="5" color="#FF6600"&gt;9.3 was on on-prime and 9.4 is on Cloud. 9.3 &lt;/FONT&gt;is a single machine install(meta,compute and mid is on the same server) but 9.4 is a multi install environment.&lt;BR /&gt;9.3 is a ODBC&lt;BR /&gt;9.4 is a SAS access.&lt;BR /&gt;Every job is working fine after migration except this.&lt;BR /&gt;I doubt on “between and “ condition and to do with date extraction. &lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The problem could be cause by moving SAS into the cloud, if the db-server are still in their old location.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Aug 2021 06:36:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-performance/m-p/761976#M241194</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-08-17T06:36:06Z</dc:date>
    </item>
    <item>
      <title>Re: Code performance</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-performance/m-p/761996#M241204</link>
      <description>I try to excute in TD</description>
      <pubDate>Tue, 17 Aug 2021 08:46:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-performance/m-p/761996#M241204</guid>
      <dc:creator>sathya66</dc:creator>
      <dc:date>2021-08-17T08:46:38Z</dc:date>
    </item>
    <item>
      <title>Re: Code performance</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-performance/m-p/761997#M241205</link>
      <description>Yes, We have and their performance is fine but users are exucuting their code half in TD (ie; extract,summery,etc)  and half in SAS (ie;first.V and final report ,etc)</description>
      <pubDate>Tue, 17 Aug 2021 08:53:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-performance/m-p/761997#M241205</guid>
      <dc:creator>sathya66</dc:creator>
      <dc:date>2021-08-17T08:53:09Z</dc:date>
    </item>
    <item>
      <title>Re: Code performance</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-performance/m-p/762016#M241211</link>
      <description>&lt;P&gt;Concur with the others. Moving a server into the cloud can have severe consequences for connections to other servers.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Aug 2021 10:57:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-performance/m-p/762016#M241211</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-08-17T10:57:55Z</dc:date>
    </item>
    <item>
      <title>Re: Code performance</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-performance/m-p/762179#M241277</link>
      <description>&lt;P&gt;I took the time to explain to you what's happening and why, and how you can improve performance. What's the issue?&lt;/P&gt;</description>
      <pubDate>Tue, 17 Aug 2021 21:59:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-performance/m-p/762179#M241277</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-08-17T21:59:59Z</dc:date>
    </item>
    <item>
      <title>Re: Code performance</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-performance/m-p/763196#M241693</link>
      <description>We are exuting in TD and it resolved the issue.&lt;BR /&gt;Thanks all.</description>
      <pubDate>Mon, 23 Aug 2021 10:05:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-performance/m-p/763196#M241693</guid>
      <dc:creator>sathya66</dc:creator>
      <dc:date>2021-08-23T10:05:24Z</dc:date>
    </item>
  </channel>
</rss>

