I'm trying to figure out a way of determing if a particular date is within a date range. For example in the dataset below. I want to see if Person ID 1 was covered on Oct 1, 2014. Is there an easy way to figure this out?
Person ID Date Begin Date End Program
1 01/01/2014 09/30/2014 AD
1 11/01/2014 12/31/2014 BB
Sure. How do you want to deal with multiple records per ID? Also, is it possible to have missing values? If so, the logic would need to be adjusted.
if date_start <= "01Oct2014"d <= date_end then coverage=1;
else coverage=0;
Sure. How do you want to deal with multiple records per ID? Also, is it possible to have missing values? If so, the logic would need to be adjusted.
if date_start <= "01Oct2014"d <= date_end then coverage=1;
else coverage=0;
Thank you! This worked out perfectly!
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!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.