Hi All, I have the following code which runs fine without the where statement. But as soon as I include it, I get an error: %let Basedate = %sysfunc(Today(),date9.); /*todays date*/ %let PrevMonthStartdate = %sysfunc(intnx(Month, "&Basedate"d,-1,b), date9.); /*start date of the previous month*/ %let PrevMonthEnddate = %sysfunc(intnx(Month, "&Basedate"d,-1,e), date9.); /*end date of the previous month*/ %put &prevmonthstartdate; data test; set XXX.TL_X; format date2 date9.; date2=trxn_date; run; procsql; connect to odbc (user="&mida_username." password="&mida_password." DSN="&mida_source."); execute( Create table LBG_REPORTING_1 as select TRXN_DATE as TRANMONTH, case when CHANNELTYPE = '@SES' then 'Digital' when CHANNELTYPE in ('@CALLCENTER','@IVR') then 'Telephony' when CHANNELTYPE is null and TRANSACTIONTYPE in ('OTP','ENROLLMENT') then 'Digi NM' else 'Other' end as CHANNEL,TRANSACTIONTYPE as MODEL, case when (TRXTYPECD = 'InternalTransfer' or TRXTYPECD like '%Me2Me%') then 1 else 0 end as ME2ME, ase when ISFILTERED = 'TRUE' then 1 else 0 end as ISFILTERED, TRXN_ID,CUSTID,AMOUNT from (select * from XXX.TL_X /*where distinct(trunc(TRXN_DATE,'MONTH')) BETWEEN TRUNC(ADD_MONTHS(SYSDATE, -1),'Month') AND TRUNC(LAST_DAY(ADD_MONTHS(SYSDATE,-1))+1)*/ where datepart(TRXN_DATE) = '&prevmonthstartdate'd )a ) by odbc; disconnectfrom odbc; quit; ERROR: CLI execute error: [Oracle][ODBC][Ora]ORA-00907: missing right parenthesis Above is the error I get. I'm guessing I'm missing something obvious? Thanks for your help guys.
... View more