The condition would be
if start_date le '30apr2020'd and end_date ge '01apr2020'd
The condition would be
if start_date le '30apr2020'd and end_date ge '01apr2020'd
It is always good to look at the inverse of a problem; in this case "which individual conditions for the dates would make it impossible for the range to contain a day of April 2020?"
This results in
if start_date gt '30apr2020'd
and
if end_dt lt '01apr2020'd
Since either would invalidate the whole condition, we use "or":
if start_date gt '30apr2020'd or end_dt lt '01apr2020'd
Then we apply some Boolean logic: to invert a compound condition (two conditions connected with AND or OR), you invert the individual parts and convert the logical operator to its opposite; that results in the solution you accepted.
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: