Hey All, Following did worked: %LET DATE=%SYSFUNC(DATETIME()); %LET MONTH_END_DT = %SYSFUNC(INTNX(DTMONTH, &DATE.,-1,E)); %LET MONTH_START_DT = %SYSFUNC(INTNX(DTMONTH, &DATE.,-1,B)); %PUT MONTH_END_DT = %SYSFUNC(PUTN(&MONTH_END_DT, DATETIME19.)); %PUT MONTH_START_DT = %SYSFUNC(PUTN(&MONTH_START_DT, DATETIME19.)); PROC SQL; CREATE TABLE WORK.TEST AS SELECT ID , OPEN_TIME, &MONTH_START_DT AS Y FORMAT DATETIME19., &MONTH_END_DT AS X FORMAT DATETIME19. FROM DETAIL.ABC WHERE &MONTH_START_DT. LE OPEN_TIME LE &MONTH_END_DT.; QUIT;
... View more