@stogez13 wrote:
Hi,
I'm trying to filter some data based on a variable.
The code I think should be something like this:
DATA need;
SET have;
IF variable1=4 THEN DO; variable2 BETWEEN TODAY()-1 AND TODAY()-3;
RUN;
but I can't use the BETWEEN in the IF THEN statement
Any suggestions?
When your code generates errors, such as this would, you should copy the code and the error messages from the LOG and paste into a code box to preserve the formatting of the error messages.
Your code generates an error message similar to:
------
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
with the underscores appearing underneath your VARIABLE2. That tells you that "between" actually wasn't the issue but that a statement involving a variable name is not valid in the position of the statement.
... View more