Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

SAS Enterprise Guide – Date value syntax error

Hope someone can help me in my case when in SAS EG.

t1.MIN_of_DATE_PARAM  - in date format
t1.MAX_of_DATE_PARAM  - in date format
    CASE WHEN t1.MIN_of_DATE_PARAM < 01JAN2019 AND t1.MAX_of_DATE_PARAM <  01JAN2019
THEN 'OLD CLIENT'  END

how can i compare it to jan12019 which I have declared in the calculation? here’s the error i get:

(CASE WHEN t1.MIN_of_DATE_PARAM < 01JAN2019 AND t1.MAX_of_DATE_PARAM <  01JAN2019
THEN 'OLD CLIENT'  END)
                                  _________
                                  22
                                  76

ERROR 22-322: Syntax error, expecting one of the following: 

enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

The error is underlined in the log, you can’t specify a date value in SAS simply by putting 01JAN2019, you need to do the following:

CASE WHEN t1.MIN_of_DATE_PARAM < '01JAN2019'd AND t1.MAX_of_DATE_PARAM <  '01JAN2019'd
THEN 'OLD CLIENT'  END

Wrapping the values in ''d converts the provided date-string into a SAS date value which can be compared with the date variables. For more information, search the SAS documentation for "SAS Date Constants".

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading