BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
einstein
Quartz | Level 8

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

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;

View solution in original post

2 REPLIES 2
Reeza
Super User

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;
einstein
Quartz | Level 8

Thank you!  This worked out perfectly!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 960 views
  • 0 likes
  • 2 in conversation