Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

the most recent date 1

Status
Not open for further replies.

irinnew

Technical User
Mar 19, 2005
81
US
Hi everybody
Could you please give me a hand?

I have the following columns in the table :
Date1, Date2, Date 3 (Date2 or 3 can be empty)

In case all three dates or at least 2 of them are populated I need just records with the most recent Date.

How can I do it?

Thank you in advance!

Irin
 
Irinnew,

Are you asking for the most recent date of the three date columns? Or, are you asking from all your records (and there could be 1000's) return only the most recent dates.

I will give you an example that shows how to get the most recent date from among several columns and insert that value into a new column "recentdate".

Code:
data test;
  set your_data;
  mostrecentdate = max(date1,date2,date3,....);
run;

SAS dates are the number of days from Jan 1 1960. This means that the higher the value, the closer the date is to the present date.

Hope this helps you out,
Klaz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top