BookmarkSubscribeRSS Feed
Adnan_Razaq
Calcite | Level 5

data have;
 input Acc  code $ effective_date possession_date;
  datalines;
    1 PO 14JUN2016 29NOV2011

    1 LA  16FEB2012 29NOV2011

    1 LB 14JUN2016 .

    2 LA 29MAR2007 27MAY2010

    2 LB 29MAR2007 28MAY2010       
;
run;

 

From this dataset what I need is if the if the codes are PO or LB and effective date is greater than possesison date the possession_date1 is effective date (of the latest PO or LB codes) else possession_date1 is equal to possession date.

3 REPLIES 3
Tom
Super User Tom
Super User

Can you add what you want the result to look like?

PeterClemmensen
Tourmaline | Level 20

What does your desired output look like? 🙂 What happens when there is a missing value?

Adnan_Razaq
Calcite | Level 5

The output which I require should look like

 

Want

 

Acc Possession_date1

1     29NOV2011

2     29MAR20017

 

The dataset contains either or both of the effective_date and possession_date. If either are missing the popukated date is to be used.

 

Thanks

 

Adnan

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