Actually, R:Base only gets confused when the left-parenthesis is
adjacent to the ampersand. R:Base does not get confused this way:
SELECT SUM(quantity) INTO vtotal FROM table WHERE year IN ( &vyears )
I prefer that for readability, to having the parens embedded within the
variable.
Bill
Lawrence Lustig wrote:
>
> SELECT SUM(quantity) INTO vtotal FROM table WHERE year IN (&vyears)
>
> which would substitute the string directly into the SQL statement.
> Unfortunately, this syntax has always confused the R:Base expression parser
> and
> will generate an error. The following, however, should work:
>
> SET VAR vYears = '(' + .vYears + ')'
> SELECT SUM(quantity) INTO vtotal FROM table WHERE year IN &vYears
>