Aloha, I am new to this community and have a question. I am trying to update a current SAS program to automate it as much as possible. This program extracts data based on selected time periods. Rather than having to open the program and updating the dates I would like to be able to have it run and automatically determined the "BEGIN" and "END" periods. Current code (modifiied) %LET BDATE = '2014-05-01'; /* Sets the beginning of the extract as the first day of the previous month */ %LET EDATE = '2014-06-30'; /* Sets the ending of the extract as the last day of the current month */ PROC SQL ; CONNECT TO ODBC(DSN=DB0P UID=&dssuid PWD=&dsspwd); CREATE TABLE DATA1 AS SELECT * FROM CONNECTION TO ODBC (SELECT DCL_SYS_YMD AS ENTRY_DT, DCL_PROC_YMD AS SERV_DT, DCL_PROV1 AS PROVIDER, DCL_RSN_CODE1 AS RVW_RSN1, DCL_RSN_CODE2 AS RVW_RSN2 FROM GETME.DRCLAIMS WHERE DCL_SYS_YMD BETWEEN &BDATE AND &EDATE ); %PUT &SQLXMSG; DISCONNECT FROM ODBC; QUIT; I tried using : %LET BPRD = intnx('month',today(),-1,'b'); %LET EPRD = intnx('month',today(),0,'e'); %LET BPR = put(&BPRD,DATE9.); %LET EPR = put(&EPRD,DATE9.); and modified my where statement to WHERE DCL_SYS_YMD BETWEEN &BPR AND &EPR I get the following error message: ERROR: CLI describe error: [IBM][CLI Driver][DB2] SQL0104N An unexpected token ")" was found following ")". Expected tokens may include: "NEXTVAL CURRVAL". SQLSTATE=42601 5079 %PUT &SQLXMSG; [IBM][CLI Driver][DB2] SQL0104N An unexpected token ")" was found following ")". Expected tokens may include: "NEXTVAL CURRVAL". SQLSTATE=42601 I have tried different ways but cannot get it to recognize the dates, any assistance would be greatly appreciated. Mahalo, Jim
... View more