<?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 missing right parenthesis in PROC SQL in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/missing-right-parenthesis-in-PROC-SQL/m-p/261510#M15524</link>
    <description>&lt;P&gt;I am trying to extract data between a static date (01012014) and last day of the previous month&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let ostart='01012014';&lt;BR /&gt;%let oend = put(intnx('month',' today()', -1, 'end'), mmddyy10.);&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;connect to odbc as ods&lt;BR /&gt;(datasrc='*********' user=------ password=------);&lt;/P&gt;&lt;P&gt;create table elig_facets as&lt;BR /&gt;select *&lt;BR /&gt;from connection to ods&lt;BR /&gt;(select edw_cmc_sbsb_subsc.sbsb_employ_id,&lt;BR /&gt;edw_cmc_mepe_prcs_elig.mepe_term_dt&lt;BR /&gt;from edw_cmc_sbsb_subsc,&lt;BR /&gt;edw_cmc_mepe_prcs_elig,&lt;BR /&gt;edw_cmc_pdds_prod_desc,&lt;BR /&gt;edw_cmc_meme_member&lt;BR /&gt;where edw_cmc_mepe_prcs_elig.pdpd_id=edw_cmc_pdds_prod_desc.pdpd_id&lt;BR /&gt;and edw_cmc_mepe_prcs_elig.meme_ck=edw_cmc_meme_member.meme_ck&lt;BR /&gt;and edw_cmc_meme_member.sbsb_ck=edw_cmc_sbsb_subsc.sbsb_ck&lt;BR /&gt;and rtrim(edw_cmc_pdds_prod_desc.php_product_type_desc) in ('centennial care')&lt;BR /&gt;and edw_cmc_mepe_prcs_elig.mepe_eff_dt_shrt between to_date ("&amp;amp;ostart"d, 'ddmmyyyy') and to_date ("&amp;amp;oend"d, 'ddmmyyyy')&lt;BR /&gt;and edw_cmc_mepe_prcs_elig.mepe_elig_ind in ('y')&lt;BR /&gt;)&lt;BR /&gt;;&lt;BR /&gt;disconnect from ods;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error is :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;42 and rtrim(edw_cmc_pdds_prod_desc.php_product_type_desc) in ('centennial care')&lt;BR /&gt;43 and edw_cmc_mepe_prcs_elig.mepe_eff_dt_shrt between to_date ("&amp;amp;ostart"d, 'ddmmyyyy') and to_date ("&amp;amp;oend"d,&lt;BR /&gt;43 ! 'ddmmyyyy')&lt;BR /&gt;44 and edw_cmc_mepe_prcs_elig.mepe_elig_ind in ('y')&lt;BR /&gt;45 )&lt;BR /&gt;46 ;&lt;BR /&gt;ERROR: CLI describe error: [Oracle][ODBC][Ora]ORA-00907: missing right parenthesis&lt;BR /&gt;NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.&lt;BR /&gt;47 disconnect from ods;&lt;BR /&gt;NOTE: Statement not executed due to NOEXEC option.&lt;BR /&gt;48 quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me with the code and thanks in advance&lt;/P&gt;</description>
    <pubDate>Tue, 05 Apr 2016 20:28:01 GMT</pubDate>
    <dc:creator>ashwini2</dc:creator>
    <dc:date>2016-04-05T20:28:01Z</dc:date>
    <item>
      <title>missing right parenthesis in PROC SQL</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/missing-right-parenthesis-in-PROC-SQL/m-p/261510#M15524</link>
      <description>&lt;P&gt;I am trying to extract data between a static date (01012014) and last day of the previous month&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let ostart='01012014';&lt;BR /&gt;%let oend = put(intnx('month',' today()', -1, 'end'), mmddyy10.);&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;connect to odbc as ods&lt;BR /&gt;(datasrc='*********' user=------ password=------);&lt;/P&gt;&lt;P&gt;create table elig_facets as&lt;BR /&gt;select *&lt;BR /&gt;from connection to ods&lt;BR /&gt;(select edw_cmc_sbsb_subsc.sbsb_employ_id,&lt;BR /&gt;edw_cmc_mepe_prcs_elig.mepe_term_dt&lt;BR /&gt;from edw_cmc_sbsb_subsc,&lt;BR /&gt;edw_cmc_mepe_prcs_elig,&lt;BR /&gt;edw_cmc_pdds_prod_desc,&lt;BR /&gt;edw_cmc_meme_member&lt;BR /&gt;where edw_cmc_mepe_prcs_elig.pdpd_id=edw_cmc_pdds_prod_desc.pdpd_id&lt;BR /&gt;and edw_cmc_mepe_prcs_elig.meme_ck=edw_cmc_meme_member.meme_ck&lt;BR /&gt;and edw_cmc_meme_member.sbsb_ck=edw_cmc_sbsb_subsc.sbsb_ck&lt;BR /&gt;and rtrim(edw_cmc_pdds_prod_desc.php_product_type_desc) in ('centennial care')&lt;BR /&gt;and edw_cmc_mepe_prcs_elig.mepe_eff_dt_shrt between to_date ("&amp;amp;ostart"d, 'ddmmyyyy') and to_date ("&amp;amp;oend"d, 'ddmmyyyy')&lt;BR /&gt;and edw_cmc_mepe_prcs_elig.mepe_elig_ind in ('y')&lt;BR /&gt;)&lt;BR /&gt;;&lt;BR /&gt;disconnect from ods;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error is :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;42 and rtrim(edw_cmc_pdds_prod_desc.php_product_type_desc) in ('centennial care')&lt;BR /&gt;43 and edw_cmc_mepe_prcs_elig.mepe_eff_dt_shrt between to_date ("&amp;amp;ostart"d, 'ddmmyyyy') and to_date ("&amp;amp;oend"d,&lt;BR /&gt;43 ! 'ddmmyyyy')&lt;BR /&gt;44 and edw_cmc_mepe_prcs_elig.mepe_elig_ind in ('y')&lt;BR /&gt;45 )&lt;BR /&gt;46 ;&lt;BR /&gt;ERROR: CLI describe error: [Oracle][ODBC][Ora]ORA-00907: missing right parenthesis&lt;BR /&gt;NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.&lt;BR /&gt;47 disconnect from ods;&lt;BR /&gt;NOTE: Statement not executed due to NOEXEC option.&lt;BR /&gt;48 quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me with the code and thanks in advance&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2016 20:28:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/missing-right-parenthesis-in-PROC-SQL/m-p/261510#M15524</guid>
      <dc:creator>ashwini2</dc:creator>
      <dc:date>2016-04-05T20:28:01Z</dc:date>
    </item>
    <item>
      <title>Re: missing right parenthesis in PROC SQL</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/missing-right-parenthesis-in-PROC-SQL/m-p/261536#M15525</link>
      <description>&lt;P&gt;Do you have an example of code that worked without macro variables?&lt;/P&gt;
&lt;P&gt;Since you are connecting to another database you have some potential conversion issues.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Normally to use a date literal in SAS the format would be ddMONyy or ddMONYY. So attempting to pass "01012014"d would normally fail.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, I expect you to get a number of errors from the creation of OEND that would have to be addressed first.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2016 21:22:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/missing-right-parenthesis-in-PROC-SQL/m-p/261536#M15525</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-04-05T21:22:34Z</dc:date>
    </item>
    <item>
      <title>Re: missing right parenthesis in PROC SQL</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/missing-right-parenthesis-in-PROC-SQL/m-p/261543#M15526</link>
      <description>&lt;P&gt;The following code &amp;nbsp;executed perfectly in Oracle SQL developer. &amp;nbsp;I had to import this into SAS and i could not do it probably because of&amp;nbsp;&lt;/P&gt;&lt;P&gt;"&lt;SPAN&gt;EDW_CMC_MEPE_PRCS_ELIG.MEPE_EFF_DT_SHRT BETWEEN TO_DATE ('01/04/01', 'DD/MM/YY') and last_day (ADD_MONTHS(sysdate, -1))"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SELECT&lt;BR /&gt;EDW_CMC_SBSB_SUBSC.SBSB_EMPLOY_ID,&lt;BR /&gt;EDW_CMC_MEPE_PRCS_ELIG.MEPE_TERM_DT&lt;BR /&gt;FROM&lt;BR /&gt;EDW_CMC_SBSB_SUBSC,&lt;BR /&gt;EDW_CMC_MEPE_PRCS_ELIG,&lt;BR /&gt;EDW_CMC_PDDS_PROD_DESC,&lt;BR /&gt;EDW_CMC_MEME_MEMBER&lt;BR /&gt;WHERE&lt;BR /&gt;( EDW_CMC_MEPE_PRCS_ELIG.PDPD_ID=EDW_CMC_PDDS_PROD_DESC.PDPD_ID(+) )&lt;BR /&gt;AND ( EDW_CMC_MEPE_PRCS_ELIG.MEME_CK=EDW_CMC_MEME_MEMBER.MEME_CK(+) )&lt;BR /&gt;AND ( EDW_CMC_MEME_MEMBER.SBSB_CK=EDW_CMC_SBSB_SUBSC.SBSB_CK(+) )&lt;BR /&gt;AND&lt;BR /&gt;(RTRIM(EDW_CMC_PDDS_PROD_DESC.PHP_PRODUCT_TYPE_DESC) IN ( 'Centennial Care' )&lt;BR /&gt;AND&lt;BR /&gt;EDW_CMC_MEPE_PRCS_ELIG.MEPE_EFF_DT_SHRT BETWEEN TO_DATE ('01/04/01', 'DD/MM/YY') and last_day (ADD_MONTHS(sysdate, -1))&lt;BR /&gt;AND&lt;BR /&gt;EDW_CMC_MEPE_PRCS_ELIG.MEPE_ELIG_IND IN ( 'Y' )&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2016 21:31:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/missing-right-parenthesis-in-PROC-SQL/m-p/261543#M15526</guid>
      <dc:creator>ashwini2</dc:creator>
      <dc:date>2016-04-05T21:31:17Z</dc:date>
    </item>
    <item>
      <title>Re: missing right parenthesis in PROC SQL</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/missing-right-parenthesis-in-PROC-SQL/m-p/261613#M15528</link>
      <description>&lt;P&gt;&amp;nbsp;This should get you closer to a solution. I'm not sure if double quotes will work in your SQL. Try double quotes with a hardcoded valid date that works with single quotes. If it fails then only single quotes are allowed. You can wrap a SAS macro variable in single quotes like this: %str(')&amp;amp;ostart%str(') and it will resolve OK.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let ostart= 01012014;
%let oend = %sysfunc(intnx(month, today(), -1, end), mmddyy10.);
proc sql;
connect to odbc as ods
(datasrc='*********' user=------ password=------);
create table elig_facets as
select *
from connection to ods
(select edw_cmc_sbsb_subsc.sbsb_employ_id,
edw_cmc_mepe_prcs_elig.mepe_term_dt
from edw_cmc_sbsb_subsc,
edw_cmc_mepe_prcs_elig,
edw_cmc_pdds_prod_desc,
edw_cmc_meme_member
where edw_cmc_mepe_prcs_elig.pdpd_id=edw_cmc_pdds_prod_desc.pdpd_id
and edw_cmc_mepe_prcs_elig.meme_ck=edw_cmc_meme_member.meme_ck
and edw_cmc_meme_member.sbsb_ck=edw_cmc_sbsb_subsc.sbsb_ck
and rtrim(edw_cmc_pdds_prod_desc.php_product_type_desc) in ('centennial care')
and edw_cmc_mepe_prcs_elig.mepe_eff_dt_shrt between to_date ("&amp;amp;ostart", 'ddmmyyyy') and to_date ("&amp;amp;oend", 'ddmmyyyy')
and edw_cmc_mepe_prcs_elig.mepe_elig_ind in ('y')
)
;
disconnect from ods;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2016 07:33:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/missing-right-parenthesis-in-PROC-SQL/m-p/261613#M15528</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2016-04-06T07:33:13Z</dc:date>
    </item>
    <item>
      <title>Re: missing right parenthesis in PROC SQL</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/missing-right-parenthesis-in-PROC-SQL/m-p/261614#M15529</link>
      <description>&lt;PRE&gt;TO_DATE ('01/04/01', 'DD/MM/YY')&lt;/PRE&gt;
&lt;P&gt;is&lt;/P&gt;
&lt;PRE&gt;'01apr2001'd&lt;/PRE&gt;
&lt;P&gt;in SAS&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;last_day (ADD_MONTHS(sysdate, -1))&lt;/PRE&gt;
&lt;P&gt;probably translates to&lt;/P&gt;
&lt;PRE&gt;intnx('month',date(),-1,'end')&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2016 07:28:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/missing-right-parenthesis-in-PROC-SQL/m-p/261614#M15529</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-04-06T07:28:29Z</dc:date>
    </item>
    <item>
      <title>Re: missing right parenthesis in PROC SQL</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/missing-right-parenthesis-in-PROC-SQL/m-p/261649#M15530</link>
      <description>&lt;P&gt;Given the code in the OP, I just wish to lift a syntactic problem (fixed in&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi﻿&lt;/a&gt;'s code), which&amp;nbsp;is you must use %sysfunc() when calling SAS function in a macro variable assignment.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2016 10:48:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/missing-right-parenthesis-in-PROC-SQL/m-p/261649#M15530</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-04-06T10:48:21Z</dc:date>
    </item>
    <item>
      <title>Re: missing right parenthesis in PROC SQL</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/missing-right-parenthesis-in-PROC-SQL/m-p/261865#M15547</link>
      <description>&lt;P&gt;Thank you so much for the suggestions people! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Since my query was working fine in Oracle, i just used a pass through and imported the result table to SAS.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2016 17:43:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/missing-right-parenthesis-in-PROC-SQL/m-p/261865#M15547</guid>
      <dc:creator>ashwini2</dc:creator>
      <dc:date>2016-04-06T17:43:14Z</dc:date>
    </item>
  </channel>
</rss>

