Help using Base SAS procedures

Date comparison

Reply
N/A
Posts: 0

Date comparison

I have data that has service-from and service-to dates. If all of the dates for a particular client are unique, I want to delete them, however, if there is any overlap, I need to keep them. One way that I thought of was to create an array, but I'm not good with those. Any other suggestions?
Super User
Posts: 5,424

Re: Date comparison

Posted in reply to deleted_user
If your data has one service-from/to pair on each observation, and the dates is all you want to keep, my suggestion is to sort your data in client and service-from (and service-to if necessary) order.
Then use RETAIN or LAG() to compare the current service-from with previous service-tom date. If overlap output the columns you want to keep.

Regards,
Linus
Data never sleeps
Ask a Question
Discussion stats
  • 1 reply
  • 108 views
  • 0 likes
  • 2 in conversation