<?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: Converting Oracle Subquery code in  SAS EG in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Converting-Oracle-Subquery-code-in-SAS-EG/m-p/427475#M13171</link>
    <description>&lt;P&gt;If you want to run this query in EG against an Oracle database then all you need to do is wrap the query into an SQL passthru step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  connect to Oracle ...put your connection details here.....;
  create table want as
  select * 
  from connection to Oracle(
  ==&amp;gt; put your Oracle query here
  );
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 13 Jan 2018 22:04:00 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2018-01-13T22:04:00Z</dc:date>
    <item>
      <title>Converting Oracle Subquery code in  SAS EG</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Converting-Oracle-Subquery-code-in-SAS-EG/m-p/427438#M13168</link>
      <description>&lt;P&gt;Dear SAS tech team &amp;amp; blogger greetings for the day.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to convert below oracle subquery code into SAS EG code I m novice to EG coding plz guide me how to do it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SELECT code_combination_id, ledger_id, period_num, NAME ledger_name,&lt;BR /&gt;period_name, period_year, unit, unit_name, account_type, ACCOUNT,&lt;BR /&gt;account_name, group1, group2, group3, group4, group5, department,&lt;BR /&gt;dept_name, group11, group12, branch, branch_name, product_line,&lt;BR /&gt;prd_line_name, SUM (opening) opening,&lt;BR /&gt;SUM (prov_opening) prov_opening,&lt;BR /&gt;SUM (NVL (period_dr, 0)) period_dr,&lt;BR /&gt;SUM (NVL (period_cr, 0)) period_cr,&lt;BR /&gt;SUM (NVL (net_period, 0)) net_period,&lt;BR /&gt;SUM (NVL (prov_net_period, 0)) prov_net_period,&lt;BR /&gt;(SELECT SUM (NVL (begin_balance_dr, 0) - NVL (begin_balance_cr, 0)&lt;BR /&gt;)&lt;BR /&gt;FROM gl_balances x&lt;BR /&gt;WHERE x.code_combination_id = gjl.code_combination_id&lt;BR /&gt;AND x.ledger_id = gjl.ledger_id&lt;BR /&gt;AND x.period_year = gjl.period_year&lt;BR /&gt;AND x.period_num = 1) ytd_opening,&lt;BR /&gt;(SELECT SUM ( NVL (x.begin_balance_dr_s, 0)&lt;BR /&gt;- NVL (x.begin_balance_cr_s, 0)&lt;BR /&gt;)&lt;BR /&gt;FROM apps.xxcns_provision_stat_gl_bal x&lt;BR /&gt;WHERE x.code_combination_id_s = gjl.code_combination_id&lt;BR /&gt;AND x.ledger_id_s = gjl.ledger_id&lt;BR /&gt;AND x.period_year_s = gjl.period_year&lt;BR /&gt;AND x.period_num_s = 1) prov_ytd_opening,&lt;BR /&gt;(SELECT SUM (NVL (x.period_net_dr, 0) + NVL (x.period_net_cr, 0)&lt;BR /&gt;)&lt;BR /&gt;FROM gl_balances x&lt;BR /&gt;WHERE x.code_combination_id = gjl.code_combination_id&lt;BR /&gt;AND x.ledger_id = gjl.ledger_id&lt;BR /&gt;AND x.period_year = gjl.period_year&lt;BR /&gt;AND x.period_num &amp;lt;= gjl.period_num) ytd_activity,&lt;BR /&gt;(SELECT SUM ( NVL (x.period_net_dr_s, 0)&lt;BR /&gt;+ NVL (x.period_net_cr_s, 0)&lt;BR /&gt;)&lt;BR /&gt;FROM apps.xxcns_provision_stat_gl_bal x&lt;BR /&gt;WHERE x.code_combination_id_s = gjl.code_combination_id&lt;BR /&gt;AND x.ledger_id_s = gjl.ledger_id&lt;BR /&gt;AND x.period_year_s = gjl.period_year&lt;BR /&gt;AND x.period_num_s &amp;lt;= gjl.period_num) prov_ytd_activity&lt;BR /&gt;--,Sum(YTD) Ytd&lt;BR /&gt;FROM (SELECT gl.NAME, gjl.period_name, gp.period_year,&lt;BR /&gt;gcc.code_combination_id, gjl.ledger_id, gjl.period_num,&lt;BR /&gt;gcc.segment1 unit,&lt;BR /&gt;(SELECT description&lt;BR /&gt;FROM fnd_flex_values_vl&lt;BR /&gt;WHERE flex_value_set_id = 1009895&lt;BR /&gt;AND flex_value_meaning = gcc.segment1&lt;BR /&gt;AND ROWNUM = 1) unit_name,&lt;BR /&gt;gcc.account_type, gcc.segment2 ACCOUNT,&lt;BR /&gt;(SELECT description&lt;BR /&gt;FROM fnd_flex_values_vl&lt;BR /&gt;WHERE flex_value_set_id = 1009896&lt;BR /&gt;AND flex_value_meaning = gcc.segment2&lt;BR /&gt;AND ROWNUM = 1) account_name,&lt;BR /&gt;(SELECT attribute1&lt;BR /&gt;FROM fnd_flex_values_vl&lt;BR /&gt;WHERE flex_value_set_id = 1009896&lt;BR /&gt;AND flex_value_meaning = gcc.segment2&lt;BR /&gt;AND ROWNUM = 1) group1,&lt;BR /&gt;(SELECT attribute2&lt;BR /&gt;FROM fnd_flex_values_vl&lt;BR /&gt;WHERE flex_value_set_id = 1009896&lt;BR /&gt;AND flex_value_meaning = gcc.segment2&lt;BR /&gt;AND ROWNUM = 1) group2,&lt;BR /&gt;(SELECT attribute3&lt;BR /&gt;FROM fnd_flex_values_vl&lt;BR /&gt;WHERE flex_value_set_id = 1009896&lt;BR /&gt;AND flex_value_meaning = gcc.segment2&lt;BR /&gt;AND ROWNUM = 1) group3,&lt;BR /&gt;(SELECT attribute4&lt;BR /&gt;FROM fnd_flex_values_vl&lt;BR /&gt;WHERE flex_value_set_id = 1009896&lt;BR /&gt;AND flex_value_meaning = gcc.segment2&lt;BR /&gt;AND ROWNUM = 1) group4,&lt;BR /&gt;(SELECT attribute5&lt;BR /&gt;FROM fnd_flex_values_vl&lt;BR /&gt;WHERE flex_value_set_id = 1009896&lt;BR /&gt;AND flex_value_meaning = gcc.segment2&lt;BR /&gt;AND ROWNUM = 1) group5,&lt;BR /&gt;gcc.segment3 department,&lt;BR /&gt;(SELECT description&lt;BR /&gt;FROM fnd_flex_values_vl&lt;BR /&gt;WHERE flex_value_set_id = 1009897&lt;BR /&gt;AND flex_value_meaning = gcc.segment3&lt;BR /&gt;AND ROWNUM = 1) dept_name,&lt;BR /&gt;(SELECT attribute1&lt;BR /&gt;FROM fnd_flex_values_vl&lt;BR /&gt;WHERE flex_value_set_id = 1009897&lt;BR /&gt;AND flex_value_meaning = gcc.segment3&lt;BR /&gt;AND ROWNUM = 1) group11,&lt;BR /&gt;(SELECT attribute2&lt;BR /&gt;FROM fnd_flex_values_vl&lt;BR /&gt;WHERE flex_value_set_id = 1009897&lt;BR /&gt;AND flex_value_meaning = gcc.segment3&lt;BR /&gt;AND ROWNUM = 1) group12,&lt;BR /&gt;gcc.segment4 branch,&lt;BR /&gt;(SELECT description&lt;BR /&gt;FROM fnd_flex_values_vl&lt;BR /&gt;WHERE flex_value_set_id = 1009898&lt;BR /&gt;AND flex_value_meaning = gcc.segment4&lt;BR /&gt;AND ROWNUM = 1) branch_name,&lt;BR /&gt;gcc.segment5 product_line,&lt;BR /&gt;(SELECT description&lt;BR /&gt;FROM fnd_flex_values_vl&lt;BR /&gt;WHERE flex_value_set_id = 1009899&lt;BR /&gt;AND flex_value_meaning = gcc.segment5&lt;BR /&gt;AND ROWNUM = 1) prd_line_name,&lt;BR /&gt;SUM ( NVL (begin_balance_dr, 0)&lt;BR /&gt;- NVL (begin_balance_cr, 0)&lt;BR /&gt;) opening,&lt;BR /&gt;SUM ( NVL (begin_balance_dr_s, 0)&lt;BR /&gt;- NVL (begin_balance_cr_s, 0)&lt;BR /&gt;) prov_opening,&lt;BR /&gt;SUM (NVL (gjl.period_net_dr, 0)) period_dr,&lt;BR /&gt;SUM (NVL (gjl.period_net_cr, 0)) period_cr,&lt;BR /&gt;SUM (NVL (gjl.period_net_dr, 0) - NVL (period_net_cr, 0)&lt;BR /&gt;) net_period,&lt;BR /&gt;SUM ( NVL (stat.period_net_dr_s, 0)&lt;BR /&gt;- NVL (period_net_cr_s, 0)&lt;BR /&gt;) prov_net_period&lt;BR /&gt;FROM gl_balances gjl,&lt;BR /&gt;apps.xxcns_provision_stat_gl_bal stat,&lt;BR /&gt;gl_ledgers gl,&lt;BR /&gt;gl_code_combinations gcc,&lt;BR /&gt;gl_periods gp&lt;BR /&gt;WHERE gjl.code_combination_id = gcc.code_combination_id&lt;BR /&gt;AND gjl.ledger_id = gl.ledger_id&lt;BR /&gt;AND gjl.period_name = gp.period_name&lt;BR /&gt;AND gjl.actual_flag = 'A'&lt;BR /&gt;AND gjl.currency_code = 'INR'&lt;BR /&gt;AND gjl.code_combination_id = stat.code_combination_id_s(+)&lt;BR /&gt;AND gjl.period_name = stat.period_name_s(+)&lt;BR /&gt;AND gjl.ledger_id = stat.ledger_id_s(+)&lt;BR /&gt;GROUP BY gcc.segment1,&lt;BR /&gt;gcc.segment2,&lt;BR /&gt;gcc.segment3,&lt;BR /&gt;gcc.segment4,&lt;BR /&gt;gcc.segment5,&lt;BR /&gt;gl.NAME,&lt;BR /&gt;gcc.account_type,&lt;BR /&gt;gjl.period_name,&lt;BR /&gt;gcc.code_combination_id,&lt;BR /&gt;gjl.ledger_id,&lt;BR /&gt;gjl.period_num,&lt;BR /&gt;gcc.account_type,&lt;BR /&gt;gp.period_year) gjl&lt;BR /&gt;WHERE 1 = 1&lt;BR /&gt;AND ABS (NVL (opening, 0))&lt;BR /&gt;+ ABS (NVL (period_dr, 0))&lt;BR /&gt;+ ABS (NVL (period_cr, 0)) != 0&lt;BR /&gt;GROUP BY code_combination_id,&lt;BR /&gt;ledger_id,&lt;BR /&gt;period_num,&lt;BR /&gt;NAME,&lt;BR /&gt;unit,&lt;BR /&gt;unit_name,&lt;BR /&gt;ACCOUNT,&lt;BR /&gt;account_name,&lt;BR /&gt;group1,&lt;BR /&gt;group2,&lt;BR /&gt;group3,&lt;BR /&gt;group4,&lt;BR /&gt;group5,&lt;BR /&gt;period_name,&lt;BR /&gt;period_year,&lt;BR /&gt;department,&lt;BR /&gt;dept_name,&lt;BR /&gt;group11,&lt;BR /&gt;group12,&lt;BR /&gt;branch,&lt;BR /&gt;branch_name,&lt;BR /&gt;product_line,&lt;BR /&gt;prd_line_name,&lt;BR /&gt;account_type;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Jan 2018 10:12:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Converting-Oracle-Subquery-code-in-SAS-EG/m-p/427438#M13168</guid>
      <dc:creator>Amrit5</dc:creator>
      <dc:date>2018-01-13T10:12:52Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Oracle Subquery code in  SAS EG</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Converting-Oracle-Subquery-code-in-SAS-EG/m-p/427445#M13169</link>
      <description>To EG you mean SAS code and not necessarily implemented in the Query Builder (I hope).&lt;BR /&gt;If your data will reside in Oracle the simplest is to wrap your code into an explicit SQL pass through block.&lt;BR /&gt;If you really need to translate it you need to identify the differences between the SQL dialects. I can see some Oracle functions in your code, and the (+) whatever that mean.&lt;BR /&gt;Also, there is no (supported) notion of ROWNUM in SAS SQL, in some cases the unsupported function monotonic() may work.</description>
      <pubDate>Sat, 13 Jan 2018 13:56:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Converting-Oracle-Subquery-code-in-SAS-EG/m-p/427445#M13169</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2018-01-13T13:56:47Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Oracle Subquery code in  SAS EG</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Converting-Oracle-Subquery-code-in-SAS-EG/m-p/427475#M13171</link>
      <description>&lt;P&gt;If you want to run this query in EG against an Oracle database then all you need to do is wrap the query into an SQL passthru step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  connect to Oracle ...put your connection details here.....;
  create table want as
  select * 
  from connection to Oracle(
  ==&amp;gt; put your Oracle query here
  );
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 13 Jan 2018 22:04:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Converting-Oracle-Subquery-code-in-SAS-EG/m-p/427475#M13171</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2018-01-13T22:04:00Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Oracle Subquery code in  SAS EG</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Converting-Oracle-Subquery-code-in-SAS-EG/m-p/427606#M13175</link>
      <description>&lt;P&gt;Dear SASKiwi,&lt;/P&gt;&lt;P&gt;Thank you so much for your valuable reply&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I already have all&amp;nbsp; the tables used in query in SAS library , do I need oracle connection&amp;nbsp;credentials&amp;nbsp; in that case also .Plz elaborate me what is to be put in place of&amp;nbsp;&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;connect to Oracle &lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token keyword"&gt;put&lt;/SPAN&gt; your connection details here&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jan 2018 06:26:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Converting-Oracle-Subquery-code-in-SAS-EG/m-p/427606#M13175</guid>
      <dc:creator>Amrit5</dc:creator>
      <dc:date>2018-01-15T06:26:30Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Oracle Subquery code in  SAS EG</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Converting-Oracle-Subquery-code-in-SAS-EG/m-p/427610#M13176</link>
      <description>Please be crisp, by SAS library do you mean data is now stored in a Base SAS library, or do you have a library defined in SAS pointing to Oracle?&lt;BR /&gt;If the first you need to decide your query. &lt;BR /&gt;If the later use the CONNECT USING option.</description>
      <pubDate>Mon, 15 Jan 2018 07:19:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Converting-Oracle-Subquery-code-in-SAS-EG/m-p/427610#M13176</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2018-01-15T07:19:13Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Oracle Subquery code in  SAS EG</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Converting-Oracle-Subquery-code-in-SAS-EG/m-p/427807#M13190</link>
      <description>&lt;P&gt;If you are going to use SQL passthru, then you don't need the Oracle tables in a SAS library.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also SAS/ACCESS to Oracle needs to be installed and licensed on your SAS server. I'm guessing this is the case otherwise you wouldn't have the Oracle tables in a SAS library.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are the details you will need in your Oracle connection:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   connect to oracle (user = MyUser password = MyPassword path = MyPath);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Jan 2018 19:41:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Converting-Oracle-Subquery-code-in-SAS-EG/m-p/427807#M13190</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2018-01-15T19:41:40Z</dc:date>
    </item>
  </channel>
</rss>

