BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
radhikaa4
Calcite | Level 5

Hi I have the following dataset

What I would like to do is to capture min two date time values, if missing use whichever one is available

IDfirst_stop_date_timesecond_stop_date_time
123401FEB20:21:56:0001FEB2020:13:15:00
456702FEB20:15:09:0003FEB2020:05:12:00
891021FEB20:00:00:00 

 

New dataset

IDfirst_stop_date_timesecond_stop_date_timemin_stop_date_time
123401FEB20:21:56:0001FEB2020:13:15:0001FEB2020:13:15:00
456702FEB20:15:09:0003FEB2020:05:12:0002FEB20:15:09:00
891021FEB20:00:00:00 21FEB20:00:00:00

 

The only way I can think of is transpose and combine into one date field and then use min. Was wondering if there is another easier way

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
Isn't that just the MIN() function?

min_stop_date_time = MIN(first_stop_date_time, second_stop_date_time);

View solution in original post

1 REPLY 1
Reeza
Super User
Isn't that just the MIN() function?

min_stop_date_time = MIN(first_stop_date_time, second_stop_date_time);

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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