When comparing dates in PROC SQL views to SQL Server tables, use datetime constants with 00 in the time portion of the datetime values. The following example assumes the LIBNAME statement has been assigned for SQL Server using either the SAS/ACCESS® Interface to ODBC or SAS/ACCESS® Interface to OLE DB:
proc sql noprint;
create view pcp_visit
as
select uid, vara, varb,varc, vard, var10, var11, datevar
from my.claims_prof
where
datevar between '01JUN2003:0:0'dt and '30JUL2004:0:0'dt
order by
uid, vardate;
quit;