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.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.