<?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 Optimizing query to SQL-Sever using SAS EG 7.1 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Optimizing-query-to-SQL-Sever-using-SAS-EG-7-1/m-p/501050#M133545</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have just been given over 2000 lines of code to optimize, the query's i need more help with and being able to spot if the PROC SQL queries are optimum as the connection is ODBC using SQL-server and i want to limit the amount of stress the in DBMS processing / pass thru does on the other end.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;we are confident after speaking to the DBA that SAS sends the exactl query across, and i can confirm this with sastrace options.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this comes down to better SQL coding, which is not my most strong point, any help will be appreciated to get this running faster&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i need to add there are 300,000,000 rows in the SQL table, of which&amp;nbsp;14,543,543 are "STRINGX"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;/*read in the relevant VAR2 outcome line per exception*/

PROC SQL;
	CREATE table work.A as select
	 	VAR1
		,max(case when VAR2="STRINGX" then id end)as NEW_STRING
	from mysqlx.B
	group by VAR1;
quit;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 03 Oct 2018 09:13:46 GMT</pubDate>
    <dc:creator>teelov</dc:creator>
    <dc:date>2018-10-03T09:13:46Z</dc:date>
    <item>
      <title>Optimizing query to SQL-Sever using SAS EG 7.1</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Optimizing-query-to-SQL-Sever-using-SAS-EG-7-1/m-p/501050#M133545</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have just been given over 2000 lines of code to optimize, the query's i need more help with and being able to spot if the PROC SQL queries are optimum as the connection is ODBC using SQL-server and i want to limit the amount of stress the in DBMS processing / pass thru does on the other end.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;we are confident after speaking to the DBA that SAS sends the exactl query across, and i can confirm this with sastrace options.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this comes down to better SQL coding, which is not my most strong point, any help will be appreciated to get this running faster&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i need to add there are 300,000,000 rows in the SQL table, of which&amp;nbsp;14,543,543 are "STRINGX"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;/*read in the relevant VAR2 outcome line per exception*/

PROC SQL;
	CREATE table work.A as select
	 	VAR1
		,max(case when VAR2="STRINGX" then id end)as NEW_STRING
	from mysqlx.B
	group by VAR1;
quit;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Oct 2018 09:13:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Optimizing-query-to-SQL-Sever-using-SAS-EG-7-1/m-p/501050#M133545</guid>
      <dc:creator>teelov</dc:creator>
      <dc:date>2018-10-03T09:13:46Z</dc:date>
    </item>
    <item>
      <title>Re: Optimizing query to SQL-Sever using SAS EG 7.1</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Optimizing-query-to-SQL-Sever-using-SAS-EG-7-1/m-p/501053#M133548</link>
      <description>&lt;P&gt;Sorry, I don't see any simple way of making that any better.&amp;nbsp; How does it relate to this 2000 lines of code - which I&amp;nbsp; assume is SQL?&amp;nbsp; Have you done a root analysis of the code, i.e. documented where each part needs to run, how things link together?&amp;nbsp; You say you don't want processing on the database - which would be where I would do it - in which extract the data to SAS, then process it there using Base SAS?&amp;nbsp; This is a whole process that you and the database team needs to go through, if you have good documentation on the whole process then it makes it a lot easier, as then you can assign various sections to the various tools, and take a deeper look at the code and data enclosed within.&lt;/P&gt;
&lt;P&gt;Sorry can't be more specific as not seeing what the "question" here is?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Oh, to add, you have the _method and _tree options in sql to show the SQL compiler actions, which may help with the SQL debugging, although the DB will likely have much better tools for it.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Oct 2018 09:11:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Optimizing-query-to-SQL-Sever-using-SAS-EG-7-1/m-p/501053#M133548</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-10-03T09:11:30Z</dc:date>
    </item>
    <item>
      <title>Re: Optimizing query to SQL-Sever using SAS EG 7.1</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Optimizing-query-to-SQL-Sever-using-SAS-EG-7-1/m-p/501059#M133549</link>
      <description>&lt;P&gt;Your reply helps a lot as thats exactly what i have done, a lot of the initial processing pulls datasets from the SQL server into SAS work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i've mapped out the entire process in a high level process flow, to also&amp;nbsp;identify what can be run in parallel.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;using SAS EG Analyze program for grid, sas was able to compile a HUGE program with a lot of Rsubmits, but there is an issue where it creates a lot of remote session and uses a slot in the queue but no CPU activity on the PID&lt;/P&gt;</description>
      <pubDate>Wed, 03 Oct 2018 09:40:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Optimizing-query-to-SQL-Sever-using-SAS-EG-7-1/m-p/501059#M133549</guid>
      <dc:creator>teelov</dc:creator>
      <dc:date>2018-10-03T09:40:57Z</dc:date>
    </item>
  </channel>
</rss>

