Current table
| subjectid | start date | starttime |
| 1 | 23-Nov-19 | 1213 |
| 2 | 24-Nov-19 | 1914 |
Need to combine date and time into one
| subjectid | start date | starttime | start_date_time |
| 1 | 23-Nov-19 | 1213 | 11/23/19 12:13 |
| 2 | 24-Nov-19 | 1914 | 11/24/19 19:14 |
I tried to concatenate but it is not a good approach
Please tell us if the variable start_date is a numeric or character variable.
Please tell us if the variable starttime is a numeric or character variable.
So date is numeric, while time is character? So you would have to convert the character string time into hours and minutes as numbers, which is what this code does.
data want;
set have;
datetime=dhms(start_date,input(substr(time,1,2),2.),input(substr(time,3,2),2.),0);
format datetime datetime16.;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
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!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.