SQL passthrough syntax to use macro variable when you specify a date value in a WHERE clause using SAS/ACCESS® Interface to ODBC


Use sinqle quotation marks around the date value on the %LET MACRO_VAR statement under the following conditions:

%let startsql = '05/07/2000';
proc sql ;
connect to ODBC as &iwsconn
(datasrc=&iwsdb
user=&iwsid
password=&iwspw);
**---------------------------------------------------------------;
* Inspection information. ;
**---------------------------------------------------------------;
create table insp_upd as
select * from connection to &iwsconn
(SELECT
"Program" = I.ProgramId,
"Client" = I.ClientId,
I.InspectionId,
"Inspectr" = I.InspectorId,
I.ReferenceNo,
I.SysAddDt,
I.SysAddId
FROM Inspection I (NOLOCK)
WHERE (I.StatusUpdDate >= &startsql)
) ;
disconnect from &iwsconn;
quit;