I am trying to use a date string parsed from &SYSPARM in a MACRO that connects to DB2 with PROC SQL and selects records within a specific date range. How do I use string variable date in format yyyymmdd in PROC SQL to select records in a specific date range? //SETVAR SET CLCD='NY',INDATE='20150316' //STEP1 EXEC SAS9,LOAD='db2loadinfo',PARM='SYSPARM="&CLCD&INDATE"' %GLOBAL MYDATE; %LET MYDATE=%SUBSTR(&SYSPARM,3,8); . %MACRO GetTRX(DBASE,TABLE,MYDATE); PROC SQL NOPRINT; CONNECT TO DB2(SSID=DBID1); CREATE TABLE &TABLE AS SELECT * FROM CONNECTION TO DB2 (SELECT * FROM &DBASE...&TABLE WHERE (TRXDT BETWEEN DATE('&MYDATE') - 7 DAYS AND DATE('&MYDATE')) ); DISCONNECT FROM DB2; QUIT; %MEND GetTRX %GeTRX(DBNM1,TRANS,&MYDATE); Received ERROR: (ACCDB2M013E) ERROR OPENING CURSOR.
... View more