Help using Base SAS procedures

Date comparison

Not applicable
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,888

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.

Data never sleeps
Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation