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

All-

 

I am trying to figure out the most efficient way to code for a "clean period," or a 6 month time period in which x=0.

 

there are three variables of interest for each observation

 

trigger date

claim date

x=  0 or 1

 

I'd like to make a new variable that flags the observation if x =1 and the time interval between the trigger date and the claim date is 6 months or less.  INTCK doesn't seem appropriate because neither date is standardized.  someone mentioned that PROC SQL "date matching" may be the right function, but I can't find syntax for that.  any ideas?

 

Thank you!

 

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

I don't know what you mean by standardized date. If your dates are SAS dates, this would work:

 


data want;
set have;
back_pn_6_mo_event = 
    back_pn and 
    intck("MONTH", claim_date, trigger_date, "CONTINUOUS") <= 6 ;
run;

If your dates are not SAS dates, then make them so.

PG

View solution in original post

3 REPLIES 3
LinusH
Tourmaline | Level 20

If you supply sample input and desired output data it would help to visualize your problem.

Data never sleeps
moreilly
Calcite | Level 5

input:

 

trigger-date  claim_date   back_pn

1/13/13   2/13/12   1

1/13/13  4/20/12   0

1/13/13  7/25/12    0

1/13/13 10/15/12  1

2/18/13  8/19/12   0

2/18/13  9/8/12    1

3/12/13 11/30/12 1

3/12/13 12/13/12 1

3/12/13  12/28/12 1

 

output

trigger-date  claim_date   back_pn  back_pn_6_mo_event

1/13/13             2/13/12           1              0

1/13/13              4/20/12           0             0

1/13/13              7/25/12           0             0

1/13/13              0/15/12           1             1

2/18/13              8/19/12           0             0

2/18/13                9/8/12           1              1

3/12/13            11/30/12           1             1

3/12/13             12/13/12          1             1

3/12/13              2/28/12           1             1

 

 

PGStats
Opal | Level 21

I don't know what you mean by standardized date. If your dates are SAS dates, this would work:

 


data want;
set have;
back_pn_6_mo_event = 
    back_pn and 
    intck("MONTH", claim_date, trigger_date, "CONTINUOUS") <= 6 ;
run;

If your dates are not SAS dates, then make them so.

PG

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 3 replies
  • 1562 views
  • 0 likes
  • 3 in conversation