Hi everyone,
I am trying to plug in a date macro variable (&curdat_2m as in the code below) in my query, but somehow I got no rows. When I used specific date like 20070515, the query ran fine. Can you see what problem with the where clause in the query? Thanks a lot!
data _null_;
curdat_2m = intnx('Month',"&sysdate"d,-2,'s');
call symput ('curdat_2m',put(curdat_2m,yymmddn8.)) ;
run;
PROC SQL;
CONNECT TO ORACLE( ...);
CREATE TABLE new_tbl as
SELECT * FROM CONNECTION TO ORACLE
(
select distinct MBR_ID, FST_NM, LST_NM, DOB, ZIP
from DB.MBR_TBL
where '&curdat_2m.' /*if using '20070515', the query generates a number of rows*/
between to_char(BEG_DT, 'YYYYMMDD')
and to_char(END_DT, 'YYYYMMDD')
);
DISCONNECT FROM ORACLE;
QUIT;
Thanks for the help!
Lizi
... View more