There are two things at play here. Firstsly, any reference to a macro variable must be between double quotes or no resolution takes place. In your case, using single quotes, DB2 will get the &a as literal text and that won't fly of course. So, use double quotes.
Secondly, the syntax of how you specify a date constant in a DB2 SQL where clause is relevant. DB2 will not accept just any format; it must be specific. Keep in mind that, since you're using Explicit SQL Passthrough, your SQL must comply to DB2 and not SAS standards. And as I remember that would be a syntax like:
date('1999-10-22')
IIRC the hyphens can also be slashes. So yes, you need the single quotes but in a way that doesn't interfere with macro variable resolution. That can be achieved using the %bquote() macro function:
AND A.CLM_OPEN_DT between %bquote(date('&A') and date('&B'))
Hope this helps,
-- Jan.
... View more