This is what I have:
I want to concatenate them all to 1 DATETIME format. How can that be done in a fast way?
You can use the MDY function to get a SAS date.
Then you can use the DHMS function to turn that date, plus hour minute second into a SAS datetime value.
See if you can use this as a template
data have;
input Year Month Day Hour Minute Second;
datalines;
2020 9 7 0 0 0
;
data want;
set have;
date = mdy(Month, Day, Year);
datetime = dhms(date, Hour, Minute, Second);
format date ddmmyy10. datetime datetime20.;
run;
Got This back, No DATALINES or INFILE statement.. Probably because I have this:
data work.merged_table;
input Year Month Day Hour Minute Second;
;
data want;
set work.merged_table;
date = mdy(Month, Day, Year );
datetime = dhms(date, Hour, Minute, Second);
format date ddmmyy10. datetime datetime20.;
run;
ALWAYS
supply example data in a data step with datalines, if you expect quick responses with a working suggestion.
A picture cannot be tested against, and we have NO IDEA AT ALL how your data really looks like.
Since the suggested code does work, the issue has to be your data.
@AK100 wrote:
Got This back, No DATALINES or INFILE statement.. Probably because I have this:
If you program work.merged_table as you did, it will be an empty data set. So, this is most likely the first problem you have.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.