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
ID | first_stop_date_time | second_stop_date_time |
1234 | 01FEB20:21:56:00 | 01FEB2020:13:15:00 |
4567 | 02FEB20:15:09:00 | 03FEB2020:05:12:00 |
8910 | 21FEB20:00:00:00 |
New dataset
ID | first_stop_date_time | second_stop_date_time | min_stop_date_time |
1234 | 01FEB20:21:56:00 | 01FEB2020:13:15:00 | 01FEB2020:13:15:00 |
4567 | 02FEB20:15:09:00 | 03FEB2020:05:12:00 | 02FEB20:15:09:00 |
8910 | 21FEB20: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
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.