I have this query below that works in Oracle, however, needed to run in SAS proc sql to join with other data. Does anyone know how to convert this statement to work with proc sql? Also, if someone is familiar with this output, how come with the invoice date range set between April and May 2021, this query still pulls in ALL dates in the ouput? with pay_cte( vendor_id,invoice_id, pay_amt,pay_cnt ) as ( select vendor_id,invoice_id, pay_amt,count(*) from ps_voucher where invoice_dt between '01-Apr-2021' and '31-May-2021' group by vendor_id,invoice_id, pay_amt having count(*)>1) select t.vendor_id, t.voucher_id,t.INVOICE_ID,t.gross_amt, t.INVOICE_DT from ps_voucher t join pay_cte p on t.vendor_id=p.vendor_id and t.invoice_id = p.invoice_id and t.gross_amt=p.pay_amt
... View more