Help using Base SAS procedures

two dates

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 145
Accepted Solution

two dates

Hi All,

I have dataset with three variable ID, DATE1, DATE2.....I have to output in such way that new datatset should have two varibles ID and lowest of dates of the two.... the two dates are 17-APR-2015 this format and should final date should be ISO8601 format....

001 17-APR-2015 17-MAY-2015

002 17-APR-2015 17-JAN-2015

OUTPUT:

001  2015-04-17

002  2015-01-17

can some one help on this....

Thanks


Accepted Solutions
Solution
‎07-09-2015 01:53 PM
Super User
Posts: 11,343

Re: two dates

Posted in reply to rakeshvvv

If the date variables are SAS date valued then just change the format to yymmdd10.

Assumes the dates are SAS date valued:

data want;

     set have;

     date = min(date1,date2);

     format date yymmdd10.;

     keep = id date;

run;

View solution in original post


All Replies
Solution
‎07-09-2015 01:53 PM
Super User
Posts: 11,343

Re: two dates

Posted in reply to rakeshvvv

If the date variables are SAS date valued then just change the format to yymmdd10.

Assumes the dates are SAS date valued:

data want;

     set have;

     date = min(date1,date2);

     format date yymmdd10.;

     keep = id date;

run;

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 210 views
  • 0 likes
  • 2 in conversation