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).
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: