Hi, Maybe i have not explained myself well, I need to translate the following query to sas code. I have in sas the datasets that correspond to the oracle tables. But since I do not know very well what the connect by does in oracle, I do not know how to translate it. Oracle query: SELECT DISTINCT * FROM k.CRAN_TABLE CB LEFT JOIN k.CODE_CRAN_REASON CCBR on (CB.REASON_ID = CCBR.ID) WHERE (CB.REASON_ID <> 109 OR (CB.REASON_ID = 109 and CB.COMMENT not like (SELECT DISTINCT E.COMMENT FROM k.CRAN_BLACK E,(SELECT DECODE(level,1, 'zz', 2, 'aa', 3, 'bb', 4, 'cc', 5, 'dd', 6, 'ee', 7, 'ff', 8, 'gg', 9, 'ii', 10, 'jj', ) n FROM dual CONNECT BY level <=10 ) l WHERE E.COMMENT LIKE l.n)))); somthing like doing in the where clause: reason_id <> 109 or reason_id = 109 and comment_open not like '%DESC%' But the '%DESC%' can have the following values: 'zz', 'aa', 'bb', 'cc', 'dd', 'ee', 'ff', 'gg', 'ii', 'jj', maybe there is an easier way to do it, but I do not know how.
... View more