Good expects.
please assist with the syntax of the below code as i am getting this error message
ERROR: Syntax error while parsing WHERE clause.
DATA WANT;
SET HAVE ;
WHERE Account_Open_Dt BETWEEN 01JANB2022 AND 28FEB2022 ;
RUN;
SAS does not know what 01JANB2022 AND 28FEB2022 means. These can't be variable names because they start with a digit, and they are not text strings because they are no enclosed in quotes. So SAS is stumped.
What you probably want is this (and note, I have fixed a typographical error in your code as well)
WHERE Account_Open_Dt BETWEEN '01JAN2022'd AND '28FEB2022'd;
When you have a date enclosed in quotes and followed by the letter d then SAS understands you mean these to be actual dates. Also please note the format within the quotes, you have to use this exact format, 2 digit day, 3 letter month and 4 digit year, without change or alteration (except that the month can be lower case).
SAS does not know what 01JANB2022 AND 28FEB2022 means. These can't be variable names because they start with a digit, and they are not text strings because they are no enclosed in quotes. So SAS is stumped.
What you probably want is this (and note, I have fixed a typographical error in your code as well)
WHERE Account_Open_Dt BETWEEN '01JAN2022'd AND '28FEB2022'd;
When you have a date enclosed in quotes and followed by the letter d then SAS understands you mean these to be actual dates. Also please note the format within the quotes, you have to use this exact format, 2 digit day, 3 letter month and 4 digit year, without change or alteration (except that the month can be lower case).
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.