BookmarkSubscribeRSS Feed
Verlea
Calcite | Level 5

I have effective and expiration dates in a dataset where I have transposed them so all for the key I have created are in a single row in the dataset.  I want to be able to compare all of the dates to see if there is a break in the dates.  My end result should be if I can combine the dates in the row to make one effective date and one expiration date.  I can't use MIN(Eff_Dt) or MAX(Exp_Dt) because I might miss breaks in the dates.

I have attached a few examples in an excel spreadsheet.

 

1 REPLY 1
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Hi,

 

Welcome to the community.  First, I advise to post anything you need to, test data and code directly into the post, I wouldnt download Office files from the net as security risk.

 

From what you post, I question the need to transpose the data to find missing periods:

data want;
  set have;
  if current_date ne lag(current_date)+1 then flag="Y";
run;

So in this example, the lag lookks back one record and if its not 1 day more than the lag value sets a flag.  No need to transpose to do this.

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 1 reply
  • 585 views
  • 0 likes
  • 2 in conversation