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

data have;

a='10jan2012'd;

b='10:20:30't;

format a date9. b time8.;

run;

but i want output like this 10jan2012:10:20:30

how can i add two values?

Thanks in advance.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
data have;
a='10jan2012'd;
b='10:20:30't;
want=dhms(a,0,0,b);
format a date9. b time8. want datetime20.;

run;

View solution in original post

3 REPLIES 3
MSK4
Obsidian | Level 7
I have tried this but i donna whether it right or wrong.
please correct me .
data a;
a='10dec2019'd;
b='10:12:30't;
format a date9. b time8.;
run;
data ab;
set a;
c=put(a,date9.);
d=put(b,time8.);
g=input(catx(':',put(a,date9.),put(b,time8.)),datetime20.);
format g datetime20.;
run;
andreas_lds
Jade | Level 19

try

datetime = dhms(a, hour(b), minutes(b), seconds(b));
Ksharp
Super User
data have;
a='10jan2012'd;
b='10:20:30't;
want=dhms(a,0,0,b);
format a date9. b time8. want datetime20.;

run;

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 3 replies
  • 1004 views
  • 5 likes
  • 3 in conversation