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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.
Ready to level-up your skills? Choose your own adventure.